public ActionResult Create(int Id) { FillDropdowns(); PolicyIssue objPolicy = new PolicyEndorsementRepository().GetNewPolicyForEndorse(Id); objPolicy.PolicySubDate = DateTime.Now; objPolicy.EndorcementDate = DateTime.Now; objPolicy.ICActualDate = DateTime.Now; objPolicy.Cheque = new PolicyIssueRepository().GetChequeDetails(Id); if (objPolicy.Cheque.Count == 0) { objPolicy.Cheque.Add(new PolicyIssueChequeReceived()); } return(View("Create", objPolicy)); }
public ActionResult Create(PolicyIssue model) { model.TranPrefix = model.TranNumber.Substring(0, model.TranNumber.LastIndexOf('/')); model.TranNumber = model.StrTranNumber; model.TranDate = System.DateTime.Now; model.CreatedDate = System.DateTime.Now; model.CreatedBy = UserID; if (!ModelState.IsValid) { var allErrors = ModelState.Values.SelectMany(v => v.Errors); return(View(model)); } Result res = new PolicyEndorsementRepository().Insert(model); if (res.Value) { TempData["Success"] = "Saved Successfully!"; } else { } return(RedirectToAction("Index")); }