public ActionResult Edit(int id) { var dao = new UserService(); var user = dao.GetUser(id); UserModel model = AutoMapper.Mapper.Map<User, UserModel>(user); //var model = new UserModel() //{ // UserId = singleUser.UserID, // FirstName = singleUser.FirstName, // LastName = singleUser.LastName, // Phone = singleUser.Phone, // Email = singleUser.Email, // AddDate = singleUser.AddDate, // ModifiedDate = singleUser.ModifiedDate, // BirthDate = singleUser.BirthDate, // IsActive = singleUser.IsActive, //}; return View(model); // return View(); }
// // GET: /Member/Details/5 public ActionResult Details(int id) { var us = new UserService(); var user = us.GetUser(id); var vm = new UserViewModel(); // vm = AutoMapper.Mapper.Map<User,UserViewModel>(user); !@#$%^& // wiem że zrobiłem na około, ale nie potrafię zrozumieć dlaczego automaper nie poradził... vm.UserId = user.UserID; vm.HasBooks = user.HasBooks; vm.IsActive = user.IsActive; vm.FirstName = user.FirstName; vm.LastName = user.LastName; vm.AddDate = user.AddDate; vm.ModifiedDate = user.ModifiedDate; vm.BirthDate = user.BirthDate; vm.Borrows = user.Borrows; vm.Email = user.Email; return View(vm); }