public ActionResult Create(int?id) { currentContext.User user = new currentContext.User(); UserModel userModel = new UserModel(); if (id > 0) { user = dataContext.Users.Where(x => x.Id == id).FirstOrDefault(); if (user != null) { ViewBag.userId = user.Id; ViewBag.userType = user.UserType; userModel = ConvertDTOtoModel(user); } } return(View(userModel)); }
private UserModel ConvertDTOtoModel(currentContext.User user) { return(new UserModel { Id = user.Id, FirstName = user.FirstName, LastName = user.LastName, Prefix = user.Prefix, EmailId = user.EmailId, PhoneNumber = user.PhoneNumber, Address = user.EmailId, IECCode = user.IECCode, GSTIN = user.GSTIN, UserName = user.UserName, Password = user.Password, CompanyName = user.CompanyName, UserType = user.UserType, Logo = user.Logo, IsActive = user.IsActive }); }