public ActionResult Create(BaseModel baseModel) { CompanyModel companyModel = new CompanyModel(); companyModel.CopyBaseModel(baseModel); using (CompanyBAL companyBAL = new CompanyBAL(ContextInfo)) { companyBAL.PrepareCompanyModel(companyModel); } return(View("Create", companyModel)); }
// GET: Company/Edit/5 public ActionResult Edit(string id, BaseModel baseModel) { CompanyModel companyModel = new CompanyModel(); companyModel.CopyBaseModel(baseModel); companyModel.Id = id; using (CompanyBAL companyBAL = new CompanyBAL(ContextInfo)) { companyBAL.GetCompanyModel(companyModel); companyBAL.PrepareCompanyModel(companyModel); } return(View(companyModel)); }
public ActionResult Create(CompanyModel companyModel) { using (CompanyBAL companyBAL = new CompanyBAL(ContextInfo)) { if (ModelState.IsValid) { companyBAL.Create(companyModel); } if (companyModel.HasErrorByType(LMYFrameWorkMVC.Common.LookUps.ErrorType.Critical) || companyModel.HasSuccess(LMYFrameWorkMVC.Common.LookUps.SuccessType.Full)) { return(base.RedirectToActionWithData(new Dictionary <string, object> { { "baseModel", companyModel } })); } companyBAL.PrepareCompanyModel(companyModel); } return(View("Create", companyModel)); }