I have controller to save record. and my code is as follows
- [HttpPost]
- public ActionResult CreateP3(Process process)
- {
- var tr = process.StageID + process.PIPENO + process.Status;
- var checkme = (from x in db.Processes
- where x.StageID + x.PIPENO + x.Status == tr && x.Status == "OK"
- select x).ToList();
- if (checkme.Count > 0)
- {
- ModelState.AddModelError("PIPENO", "You are trying Duplicate Pipe Entry");
- }
- if (ModelState.IsValid)
- {
- if (process.PipeAl.Order.THK > 1)
- {
- process.MPP = 20;
- }
- else
- {
- process.MPP = 1;
- }
- process.CuttingSpeed = (process.ActualMeter*1000)/process.CuttingTime;
- db.Processes.Add(process);
- db.SaveChanges();
- return RedirectToAction("IndexP3");
- }
But I get object reference not set on an instance of an object error. Pls help