/// <summary> /// Deletes Single <see cref="ApplicationUser"/> From Database by <see cref="DeleteApplicationUserViewModel"/> /// </summary> /// <param name="model"></param> /// <returns><see cref="bool"/></returns> public async Task <bool> DeleteSingleApplicationUser(DeleteApplicationUserViewModel model) { if (_healthyGamerPortalDbContext.ApplicationUsers.AsNoTracking().First(i => i.Id == model.Id) != null) { ApplicationUser DeleteApplicationUser = _mapper.Map <ApplicationUser>(model); _healthyGamerPortalDbContext.Remove(DeleteApplicationUser); await _healthyGamerPortalDbContext.SaveChangesAsync(); return(true); } return(false); }
public async Task <IActionResult> Delete(DeleteApplicationUserViewModel model) { if (ModelState.IsValid) { var api = RestService.For <IHealthyGamerPortalUserApi>(new HttpClient(new Helpers.AuthenticatedHttpClientHandler()) { BaseAddress = new Uri(BaseUrl) }); var response = await api.DeleteSingleApplicationUser(model); if (response.Result) { } } return(PartialView("_Delete", model)); }
public async Task <IActionResult> DeleteSingleApplicationUser([FromBody] DeleteApplicationUserViewModel model) { var result = await _applicationUserService.DeleteSingleApplicationUser(model); return(Ok(GenerateSuccessfulResponse(result))); }