/// <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);
        }
예제 #2
0
        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));
        }
예제 #3
0
        public async Task <IActionResult> DeleteSingleApplicationUser([FromBody] DeleteApplicationUserViewModel model)
        {
            var result = await _applicationUserService.DeleteSingleApplicationUser(model);

            return(Ok(GenerateSuccessfulResponse(result)));
        }