public Message AddOrEdit(PricingTableType pricingTableType) { var message = new Message(); var ID = pricingTableType.PricingTableTypeID; int result = _iPricingTableTypeRepository.AddOrEdit(pricingTableType); try { if (result > 0) { if (Convert.ToInt32(ID) > 0) { message = Message.SetMessages.SetSuccessMessage("Submission Updated Successfully!"); } else { message = Message.SetMessages.SetSuccessMessage("Submission Successful!"); } } else { message = Message.SetMessages.SetErrorMessage("Could not be submitted!"); } } catch (Exception e) { message = Message.SetMessages.SetWarningMessage(e.Message.ToString()); } return(message); }
public ActionResult AddOrEdit(int id = 0) { PricingTableType pricingTableType = new PricingTableType(); if (id != 0) { pricingTableType = _iPricingTableTypeManager.GetAPricingTableType(id); } return(View(pricingTableType)); }
public int AddOrEdit(PricingTableType pricingTableType) { if (pricingTableType.PricingTableTypeID == 0) { pricingTableType.CreatedDate = DateTime.Now; pricingTableType.UpdatedDate = DateTime.Now; pricingTableType.CreatedBy = 1; pricingTableType.UpdatedBy = 1; _dbContext.PricingTableTypes.Add(pricingTableType); } else { pricingTableType.UpdatedBy = 1; pricingTableType.UpdatedDate = DateTime.Now; _dbContext.Entry(pricingTableType).State = EntityState.Modified; } return(_dbContext.SaveChanges()); }
public ActionResult AddOrEdit(PricingTableType pricingTableType) { var data = _iPricingTableTypeManager.AddOrEdit(pricingTableType); return(Json(new { messageType = data.MessageType, message = data.ReturnMessage, html = GlobalClass.RenderRazorViewToString(this, "ViewAll", _iPricingTableTypeManager.GetAllPricingTableType()) }, JsonRequestBehavior.AllowGet)); }