//Thêm gói cước public JsonResultModel AddServicePlan(ListServicePlanOutputModel dt) { try { ServicePlan check = cnn.ServicePlans.Where(sv => sv.IsActive.Equals(SystemParam.ACTIVE) && sv.Name.Equals(dt.Name) && sv.CategoryID.Equals(dt.CateID)).FirstOrDefault(); if (check != null) { return(rp.response(SystemParam.ERROR, SystemParam.CODE_EXISTING, SystemParam.ERROR_MESSAGE_SERVICE_PLAN_EXISTING, "")); } ServicePlan s = new ServicePlan(); s.Name = dt.Name; s.Status = dt.Status; s.Price = dt.Price; s.IsActive = SystemParam.ACTIVE; s.CreatedDate = DateTime.Now; s.Description = dt.Descreiption; s.ImageUrl = dt.ImageUrl; s.CategoryID = dt.CateID; s.Value = dt.Value; cnn.ServicePlans.Add(s); cnn.SaveChanges(); return(rp.response(SystemParam.SUCCESS, SystemParam.SUCCESS_CODE, SystemParam.SUCCESS_MESSAGE, "")); } catch { return(rp.serverError()); } }
public JsonResult UpdateServicePlan(ListServicePlanOutputModel input) { return(Json(servicePlanBusiness.UpdateServicePlan(input), JsonRequestBehavior.AllowGet)); }