public Message AddOrEdit(PricingDetailType pricingDetailType) { var message = new Message(); var ID = pricingDetailType.PricingDetailTypeID; int result = _iPricingDetailTypeRepository.AddOrEdit(pricingDetailType); 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) { PricingDetailType pricingDetailType = new PricingDetailType(); if (id != 0) { pricingDetailType = _iPricingDetailTypeManager.GetAPricingDetailType(id); } return(View(pricingDetailType)); }
public int AddOrEdit(PricingDetailType pricingDetailType) { if (pricingDetailType.PricingDetailTypeID == 0) { pricingDetailType.CreatedDate = DateTime.Now; pricingDetailType.UpdatedDate = DateTime.Now; pricingDetailType.CreatedBy = 1; pricingDetailType.UpdatedBy = 1; _dbContext.PricingDetailTypes.Add(pricingDetailType); } else { pricingDetailType.UpdatedBy = 1; pricingDetailType.UpdatedDate = DateTime.Now; _dbContext.Entry(pricingDetailType).State = EntityState.Modified; } return(_dbContext.SaveChanges()); }
public ActionResult AddOrEdit(PricingDetailType pricingDetailType) { var data = _iPricingDetailTypeManager.AddOrEdit(pricingDetailType); return(Json(new { messageType = data.MessageType, message = data.ReturnMessage, html = GlobalClass.RenderRazorViewToString(this, "ViewAll", _iPricingDetailTypeManager.GetAllPricingDetailType()) }, JsonRequestBehavior.AllowGet)); }