public Form Map(CreateOrEditViewModel createOrEdit) { Form form = new Form(); if (createOrEdit.Id != null) form = this.handler.Storage.GetRepository<IFormRepository>().WithKey((int)createOrEdit.Id); form.Code = createOrEdit.Code; form.Email = createOrEdit.Email; return form; }
public Form Map(CreateOrEditViewModel createOrEdit) { Form form = new Form(); if (createOrEdit.Id != null) { form = this.handler.Storage.GetRepository <IFormRepository>().WithKey((int)createOrEdit.Id); } form.Code = createOrEdit.Code; form.Email = createOrEdit.Email; return(form); }
public Form Map(CreateOrEditViewModel createOrEdit) { Form form = new Form(); if (createOrEdit.Id != null) { form = this.RequestHandler.Storage.GetRepository <IFormRepository>().WithKey((int)createOrEdit.Id); } form.Code = createOrEdit.Code; form.ProduceCompletedForms = createOrEdit.ProduceCompletedForms; form.CSharpClassName = createOrEdit.CSharpClassName; form.Parameters = createOrEdit.Parameters; return(form); }
public IActionResult CreateOrEdit(CreateOrEditViewModel createOrEdit) { if (this.ModelState.IsValid) { Form form = new CreateOrEditViewModelMapper(this).Map(createOrEdit); this.CreateOrEditEntityLocalizations(form); if (createOrEdit.Id == null) this.Storage.GetRepository<IFormRepository>().Create(form); else this.Storage.GetRepository<IFormRepository>().Edit(form); this.Storage.Save(); new CacheManager(this).CacheForm(form); return this.RedirectToAction("Index"); } return this.CreateRedirectToSelfResult(); }