public ActionResult CreateForm(FormDTO model) { try { model.Id = Guid.NewGuid(); //model.Password = Md5Hash.GetMd5Hash("1234"); _formService.Save(model); return RedirectToAction("Index"); } catch (DomainValidationException ve) { ve.DomainValidationErrors(ModelState); bind(); return View(); } catch (Exception ex) { ModelState.AddModelError("", ex.Message); bind(); return View(); } return View(); }
public void Save(FormDTO dto) { var entity= new DformEntity(); entity.Id = dto.Id; entity.ClientId = dto.ClientId; entity.IdCode = dto.Code; entity.Name = dto.Name; _formRepository.SaveForm(entity); }
public ActionResult EditForm(FormDTO model) { try { _formService.Save(model); return RedirectToAction("Index"); } catch (DomainValidationException ve) { ve.DomainValidationErrors(ModelState); bind(); return View(); } catch (Exception ex) { ModelState.AddModelError("", ex.Message); bind(); return View(); } return View(); }