public async Task CheckIfGetViewModelByIdAsyncWorksCorrectly() { this.SeedDatabase(); var expectedModel = new CookingHubUserDetailsViewModel { Id = this.firstCookingHubUser.Id, Username = this.firstCookingHubUser.UserName, FullName = this.firstCookingHubUser.FullName, CreatedOn = this.firstCookingHubUser.CreatedOn, isDeleted = this.firstCookingHubUser.IsDeleted, Gender = this.firstCookingHubUser.Gender, }; var viewModel = await this.cookingHubUsersService .GetViewModelByIdAsync <CookingHubUserDetailsViewModel>(this.firstCookingHubUser.Id); var expectedObj = JsonConvert.SerializeObject(expectedModel); var actualResultObj = JsonConvert.SerializeObject(viewModel); Assert.Equal(expectedObj, actualResultObj); }
public async Task <IActionResult> Unban(CookingHubUserDetailsViewModel cookingHubUserDetailsViewModel) { await this.cookingHubUsersService.UnbanByIdAsync(cookingHubUserDetailsViewModel.Id); return(this.RedirectToAction("GetAll", "CookingHubUsers", new { area = "Administration" })); }