public FileUserModel(FileUser model) { //Mapper.CreateMap<FileUser, FileUserModel>() // .ForMember(m => m.Address, d => d.MapFrom(f => (f.Address ?? string.Empty).Split('\n'))); Name = model.Name; Age = model.Age; Address = (model.Address ?? string.Empty).Split('\n').ToList(); }
public ActionResult CreateFileUser(FileUser model) { try { var fileUser = new FileUserModel(model); Context.FileUsers.Insert(fileUser); return RedirectToAction("Index"); } catch { return View(); } }
// GET: Mongo/Create public ActionResult CreateFileUser() { FileUser user = new FileUser(); return View(user); }