public async Task <ActionResult> ChangeShopStatus(ShopStatusDTO shopStatusDto) { ShopModel shop = await userCosmosDBService.GetUserInfo(shopStatusDto.UserEmail); if (shop != null) { shop.Status = shopStatusDto.Status; if (await userCosmosDBService.ReplaceDocumentAsync(shop.SelfLink, shop)) { return(Ok("Shop status changed successfully")); } return(StatusCode(500, "Unable to update the status")); } return(BadRequest("Couldn't find the shop specified")); }
public async Task <ActionResult> UpdateProfile(UpdateProfileDTO updateProfileDTO) { ShopModel shop = await userCosmosDBService.GetUserInfo(updateProfileDTO.UserEmail); mapper.Map(updateProfileDTO, shop, typeof(UpdateProfileDTO), typeof(ShopModel)); if (!string.IsNullOrWhiteSpace(updateProfileDTO.Password)) { Encryption.CreatePasswordHash(updateProfileDTO.Password, out byte[] passwordHash, out byte[] passwordSalt); shop.PasswordHash = passwordHash; shop.PasswordSalt = passwordSalt; } if (await userCosmosDBService.ReplaceDocumentAsync(shop.SelfLink, shop)) { return(Ok("Successfully updated the profile of the user")); } return(BadRequest("Something Went Wrong!")); }