public async Task <int> AddOrganization(UserOrganisazionVM modelVM) { try { return(await StdRepo.ExcuteStoredProcedureToSave <UserOrganisazionVM>(GlobalSPNames.AddOrganizationSPName, modelVM)); } catch (Exception ex) { throw ex; } }
public async Task <IHttpActionResult> RegisterSeller(UserOrganisazionVM userModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } IdentityResult result = await _repo.RegisterSeller(userModel); IHttpActionResult errorResult = GetErrorResult(result); if (errorResult != null) { return(errorResult); } return(Ok()); }
/// <summary> /// This method will add Organization and the user in same time. /// Pass the disired view model to get successfull result /// </summary> /// <param name="userModel">Type of UserOrganisazionVM</param> /// <returns></returns> public async Task <IdentityResult> RegisterSeller(UserOrganisazionVM userModel) { IdentityUser user = new IdentityUser { UserName = userModel.User.UserName, }; //Saving the user to the ASP.NET user tables var result = await _userManager.CreateAsync(user, userModel.User.Password); //Set the user id to the ASP.net User id userModel.User.UserId = user.Id; userModel.Organization.IsSeller = true; //If above was successfull then we will add the organization and our detail user accounts if (result.Succeeded) { CoparateReporitory corprepo = new CoparateReporitory(); await corprepo.AddOrganization(userModel); } return(result); }