public ActionResult Actions() { var msg = new JsonMessage { Erros = false, Message = "Cập nhật thành công" }; switch (DoAction) { case ActionType.Add: var model = new PolicyAgenciesItem(); UpdateModel(model); var policy = new PolicyAgency() { CategoryId = model.CategoryId, Profit = model.Profit, Quantity = model.Quantity, LevelAgency = model.LevelAgency, PercentProfit = model.PercentProfit, }; _policyAgencyDa.Add(policy); _policyAgencyDa.Save(); break; case ActionType.Edit: var modelUpdate = new PolicyAgenciesItem(); UpdateModel(modelUpdate); var policyUpdate = _policyAgencyDa.GetById(ArrId.FirstOrDefault()); policyUpdate.Quantity = modelUpdate.Quantity; policyUpdate.Profit = modelUpdate.Profit; policyUpdate.LevelAgency = modelUpdate.LevelAgency; policyUpdate.PercentProfit = modelUpdate.PercentProfit; _policyAgencyDa.Save(); break; case ActionType.Delete: var policyDelete = _policyAgencyDa.GetById(ArrId.FirstOrDefault()); policyDelete.Isdelete = true; _policyAgencyDa.Save(); break; } return(Json(msg)); }
public void Add(PolicyAgency item) { FDIDB.PolicyAgencies.Add(item); }