public ActionResult CreateUsers(UserModel user) { IUserFacade usersFacade = (IUserFacade)FacadeFactory.Instance.Create(FacadeType.UserFacade); IUserDTO usersDTO = (IUserDTO)DTOFactory.Instance.Create(DTOType.UserDTO); HttpPostedFileBase file = Request.Files["ImageData"]; user.Image = convertToBytes(file); if (ModelState.IsValid) { DTOConverter.FillDTOFromViewModel(usersDTO, user); OperationResult <IUserDTO> result = usersFacade.CreateUser(usersDTO); //List<UsersModel> list = new List<UsersModel>(); if (result.IsValid()) { //foreach (var item in result.Data) //{ //UsersModel user1 = new UsersModel(); //DTOConverter.FillViewModelFromDTO(user, result); //list.Add(user); //Console.WriteLine(item.Balance); //Console.WriteLine(item.Contact); //} Console.WriteLine("Completed"); } } if (ModelState.IsValid) { DTOConverter.FillDTOFromViewModel(usersDTO, user); OperationResult <IUserDTO> result = usersFacade.CreateUser(usersDTO); if (result.ValidationResult != null && result.ValidationResult.Errors != null) { IList <EmployeePortalValidationFailure> resultFail = result.ValidationResult.Errors; foreach (var item in resultFail) { ModelState.AddModelError(item.PropertyName, item.ErrorMessage); } return(View()); } } //else //{ // IList<EmployeePortalValidationFailure> resultFail = result.ValidationResult.Errors; // foreach (var item in resultFail) // { // } //} return(RedirectToAction("GetAllUser", "User")); }
public ActionResult <User> CreateUser(string userType, string userId) { var user = _userFacade.CreateUser(userType, userId); if (user == null) { NotFound(); } return(user); }
public ActionResult CreateUser(UserModel responseModel) { IUserDto userDtoToCreate = (IUserDto)DtoFactory.Instance.Create(DtoType.UserDto); HttpPostedFileBase file = Request.Files["ImageData"]; responseModel.IdentityProof = ConvertToBytes(file); if (ModelState.IsValid) { DTOConverter.FillDTOFromViewModel(userDtoToCreate, responseModel); OperationResult <IUserDto> resultCreate = _userFacade.CreateUser(userDtoToCreate); if (resultCreate.ValidationResult != null && resultCreate.ValidationResult.Errors != null) { IList <EmployeePortalValidationFailure> resultFail = resultCreate.ValidationResult.Errors; foreach (var item in resultFail) { ModelState.AddModelError(item.PropertyName, item.ErrorMessage); } return(View()); } return(View("../Home/Index")); } return(View()); }
public ActionResult RegisterUser(UserRegistrationModel user) { IUserFacade userFacade = (IUserFacade)FacadeFactory.Instance.Create(FacadeType.UserFacade); IUserDTO createCustomerDTO = (IUserDTO)DTOFactory.Instance.Create(DTOType.UserDTO); HttpPostedFileBase file = Request.Files["ImageData"]; user.Copy_of_Id = convertToBytes(file); if (ModelState.IsValid) { DTOConverter.FillDTOFromViewModel(createCustomerDTO, user); OperationResult <IUserDTO> result = userFacade.CreateUser(createCustomerDTO); if (result.ValidationResult != null && result.ValidationResult.Errors != null) { IList <CasinoAppValidationFailure> resultFail = result.ValidationResult.Errors; foreach (var item in resultFail) { ModelState.AddModelError(item.PropertyName, item.ErrorMessage); } return(View()); } } return(RedirectToAction("Index", "Home")); }
public ActionResult Create(ConfigUser model) { userReader.CreateUser(model); return(RedirectToAction("Index")); }