public virtual ActionResult Create(UserProfile userprofile) { if (ModelState.IsValid) { userprofile.Password = MD5Hashing.MD5Hash(userprofile.Password); _userProfileService.AddUserProfile(userprofile); return(Json(new { success = true })); } ViewBag.UserProfileID = new SelectList(_userRoleService.GetAllUserRole(), "UserRoleID", "UserRoleID", userprofile.UserProfileID); return(PartialView("Users/Create", userprofile)); }
public async Task <ActionResult> PostUserProfile(UserProfileReceivingDTO userProfileReceiving) { var response = await _userProfileService.AddUserProfile(userProfileReceiving); if (response.StatusCode >= 400) { return(StatusCode(response.StatusCode, response)); } var user = ((ApiOkResponse)response).Result; return(Ok((UserProfileTransferDTO)user)); }
public async Task <ActionResult> UpdateProfile(UserProfileReceivingDTO userProfileReceivingDTO) { var response = await userProfileService.AddUserProfile(userProfileReceivingDTO); if (response.StatusCode >= 400) { return(StatusCode(response.StatusCode, response)); } var user = ((ApiOkResponse)response).Result; var userProfile = (UserProfileTransferDTO)user; var token = GenerateToken(userProfile); UserAuthTransferDTO userAuthTransferDTO = new UserAuthTransferDTO() { Token = token, UserProfile = userProfile }; return(Ok(userAuthTransferDTO)); }