public ActionResult Update(string key, List <spView_WebTemplate_SMC_SLMGetAll_Result> changed, List <spView_WebTemplate_SMC_SLMGetAll_Result> added, List <spView_WebTemplate_SMC_SLMGetAll_Result> deleted) { Formulas formulas = new Formulas(); var order_no = TempData.Peek("OrderNumber").ToString(); OrderSMCModels obj = new OrderSMCModels(); ////Performing update operation if (changed != null && changed.Count() > 0) { foreach (var temp in changed) { obj.OrderNumber = order_no; //obj.StartDate = System.Convert.ToDateTime(temp.StartDate); //obj.EndDate = System.Convert.ToDateTime(temp.EndDate); //obj.FacilityCode = System.Convert.ToInt32(temp.FacilityCode); obj.ProductCode = System.Convert.ToInt32(temp.ProductCode); obj.OpeningBalance = temp.OpeningBalance; obj.QtyRecieved = temp.QtyRecieved; obj.Consumption = temp.Consumption; obj.LossesAndAdjustments = temp.LossesAndAdjustments; obj.TotalClosingBalance = temp.TotalClosingBalance; obj.QuantityToOrder = Convert.ToDouble(formulas.Allocated((3 * temp.Consumption) - temp.TotalClosingBalance)); obj.QuantityAllocated = (formulas.Allocated((3 * temp.Consumption) - temp.TotalClosingBalance)); obj.Comments = temp.Comments; obj.RFSONotes = temp.RFSONotes; obj.Update(); } } //Performing delete operation //if (deleted != null && deleted.Count() > 0) //{ // foreach (var temp in deleted) // { // db.core_householdmember.Remove(db.core_householdmember.FirstOrDefault(o => o.id == temp.id)); // } //} //db.SaveChanges(); //var data = 0; return Json(data, JsonRequestBehavior.AllowGet); var data = 0; return(Json(data, JsonRequestBehavior.AllowGet)); }
public ActionResult UpdateCustom(string key, List <spView_WebTemplate_SMC_SLMGetAll_Custom1_Result> changed, List <spView_WebTemplate_SMC_SLMGetAll_Custom1_Result> added, List <spView_WebTemplate_SMC_SLMGetAll_Custom1_Result> deleted) { var order_no = TempData.Peek("OrderNumber").ToString(); OrderSMCModels obj = new OrderSMCModels(); ////Performing update operation if (added != null && added.Count() > 0) { foreach (var temp in added) { obj.OrderNumber = order_no; obj.ProductCode = System.Convert.ToInt32(temp.product_code); obj.QuantityToOrder = temp.QuantityToOrder; obj.QuantityAllocated = System.Convert.ToInt32(temp.QuantityToOrder); obj.Comments = temp.Comments; obj.RFSONotes = temp.RFSONotes; obj.Update(); } } if (changed != null && changed.Count() > 0) { foreach (var temp in changed) { obj.OrderNumber = order_no; obj.ProductCode = System.Convert.ToInt32(temp.product_code); obj.QuantityToOrder = temp.QuantityToOrder; obj.QuantityAllocated = System.Convert.ToInt32(temp.QuantityToOrder); obj.Comments = temp.Comments; obj.RFSONotes = temp.RFSONotes; obj.Update(); } } //var data = 0; return Json(data, JsonRequestBehavior.AllowGet); var data = 0; return(Json(data, JsonRequestBehavior.AllowGet)); }