コード例 #1
0
        public async Task <IActionResult> Delete([FromRoute] Guid recordId)
        {
            var deleted = await _recordService.DeleteRecord(recordId);

            if (deleted)
            {
                return(NoContent());
            }

            return(NotFound());
        }
コード例 #2
0
 public async Task Delete()
 {
     try
     {
         await _recordService.DeleteRecord(SelectedRecord.Id);
         await LoadRecords();
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
コード例 #3
0
ファイル: RecordController.cs プロジェクト: timc986/mwp
        [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 }));
            }
        }
コード例 #4
0
        public ActionResult Delete(int id, IFormCollection collection)
        {
            service.DeleteRecord(id);

            return(RedirectToAction(nameof(UserList)));
        }
コード例 #5
0
 public IActionResult DeleteRecord(Guid burialID)
 {
     _recordService.DeleteLocation(_recordService.GetRecord(burialID).LocationId.Value);
     _recordService.DeleteRecord(burialID);
     return(RedirectToAction("BurialRecords"));
 }
コード例 #6
0
ファイル: RecordsController.cs プロジェクト: nallj/Jbn.Ttmwt
 public async Task DeleteRecord(int recordId, [FromServices] IRecordService recordSvc)
 {
     await recordSvc.DeleteRecord(recordId);
 }