public async Task <IActionResult> Delete([FromRoute] Guid recordId) { var deleted = await _recordService.DeleteRecord(recordId); if (deleted) { return(NoContent()); } return(NotFound()); }
public async Task Delete() { try { await _recordService.DeleteRecord(SelectedRecord.Id); await LoadRecords(); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
[HttpDelete("delete")] //delete?recordId=999 public async Task <IActionResult> DeleteRecord(long recordId) { try { var userIdClaim = HttpContext.User.Claims.FirstOrDefault(c => c.Type == "userId"); if (userIdClaim == null) { return(BadRequest(new { message = "Invalid token" })); } await recordService.DeleteRecord(recordId, userIdClaim.Value); return(Ok()); } catch (Exception ex) { return(BadRequest(new { message = ex.Message })); } }
public ActionResult Delete(int id, IFormCollection collection) { service.DeleteRecord(id); return(RedirectToAction(nameof(UserList))); }
public IActionResult DeleteRecord(Guid burialID) { _recordService.DeleteLocation(_recordService.GetRecord(burialID).LocationId.Value); _recordService.DeleteRecord(burialID); return(RedirectToAction("BurialRecords")); }
public async Task DeleteRecord(int recordId, [FromServices] IRecordService recordSvc) { await recordSvc.DeleteRecord(recordId); }