public ActionResult Save(SaleBillHeaderViewModel model, bool IsPreviewVoucher) { if (ModelState.IsValid) { if (IsPreviewVoucher) { var voucherHeader = this.MapToEntity(model); var voucherdetails = this.ConvertVoucherModelToViewModel(voucherHeader.VoucherHeader.VoucherDetails); return(Json(voucherdetails, JsonRequestBehavior.AllowGet)); } else { if (model.SaleBillHeaderid == 0) { var entity = this.MapToEntity(model); db.SaleBillHeaders.Add(entity); db.SaveChanges(); } return(Json(ConfirmationMessages.CreateSuccessConfirmation("Record Saved Successfully"))); } } else { return(View("Create", new SaleBillHeaderViewModel())); } //return Json("Error Occurred While Saving"); }
public ActionResult Save(AccountsViewModel model) { if (model.AccountId == 0) { var entity = MapToEntity(model); db.Account.Add(entity); db.SaveChanges(); } return(Json(ConfirmationMessages.CreateSuccessConfirmation("Record Saved Successfully"))); }