public async Task <IActionResult> DeletePerson([FromRoute] int id) { try { if (!this.ModelState.IsValid) { return(this.BadRequest(this.ModelState)); } logger.LogInformation(1100, $"Deleting person."); await peopleService.DeleteAsync(id); await peopleService.SaveAsync(); return(NoContent()); } catch (ArgumentException) { return(this.BadRequest($"Invalid data.")); } catch (Exception ex) { logger.LogError(1500, ex, $"{UpdateErrorMessage} URL: {Request.GetEncodedPathAndQuery()}, Person ID: {id}."); return(StatusCode(500, new { Message = SystemError })); } }
public IActionResult Delete(int id) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var result = _peopleService.DeleteAsync(id, string.Empty); if (!result.Result.IsValid) { return(BadRequest(result.Result)); } return(NoContent()); }
public async Task <ApiResultLite> DeleteAsync(int id) { var result = await _PeopleService.DeleteAsync(id); return(result); }
public async Task <IActionResult> DeleteConfirmed(string id) { await _people.DeleteAsync(id); return(RedirectToAction(nameof(Index))); }
public async Task Delete(int id) { await peopleService.DeleteAsync(id); }
// POST: People/Delete/5 public async Task <IActionResult> Delete(int id) { var value = await _peopleService.DeleteAsync(id); return(RedirectToAction("Favourite")); }