private string updateProductClass(HttpContext context) { try { using (AMSCM.Models.AMSCM amscm = new AMSCM.Models.AMSCM()) { AMSCM.Models.tbProductClass productClass = amscm.tbProductClass.Find(context.Request.Form["cnvcProductClassCode"]); productClass.cnvcProductType = context.Request.Form["cnvcProductType"]; productClass.cnvcProductClassName = context.Request.Form["cnvcProductClassName"]; productClass.cnnDays = Convert.ToInt32(context.Request.Form["cnnDays"]); productClass.cnvcComments = context.Request.Form["cnvcComments"]; amscm.SaveChanges(); } } catch (NullReferenceException nex) { ExceptionPolicy.HandleException(nex, ServiceHelper.ExceptionPolicy); return(ServiceHelper.JsonSerializer <JEasyUIResult>(new JEasyUIResult(false, nex.Message))); } catch (DbUpdateException dex) { ExceptionPolicy.HandleException(dex, ServiceHelper.ExceptionPolicy); return(ServiceHelper.JsonSerializer <JEasyUIResult>(new JEasyUIResult(false, dex.Message))); } return(ServiceHelper.JsonSerializer <JEasyUIResult>(new JEasyUIResult(true, ""))); }
private string removeProductClass(HttpContext context) { try { using (AMSCM.Models.AMSCM amscm = new AMSCM.Models.AMSCM()) { AMSCM.Models.tbProductClass productClass = amscm.tbProductClass.Find(context.Request.Form["cnvcProductClassCode"]); amscm.tbProductClass.Remove(productClass); amscm.SaveChanges(); } } catch (ArgumentNullException aex) { ExceptionPolicy.HandleException(aex, ServiceHelper.ExceptionPolicy); return(ServiceHelper.JsonSerializer <JEasyUIResult>(new JEasyUIResult(false, aex.Message))); } catch (DbUpdateException dex) { ExceptionPolicy.HandleException(dex, ServiceHelper.ExceptionPolicy); return(ServiceHelper.JsonSerializer <JEasyUIResult>(new JEasyUIResult(false, dex.Message))); } return(ServiceHelper.JsonSerializer <JEasyUIResult>(new JEasyUIResult(true, ""))); }