コード例 #1
0
        public async Task <IActionResult> DeleteTrip(int id)
        {
            if (!_tripService.TripExists(id))
            {
                return(NotFound());
            }

            await _tripService.Delete(id);

            return(NoContent());
        }
コード例 #2
0
        public void DeleteTest()
        {
            var claims = new List <Claim>()
            {
                new Claim(ClaimTypes.Name, "username"),
                new Claim(ClaimTypes.NameIdentifier, "123"),
            };

            _tripService.Delete(2, claims);
            var art = _context.Trips.FirstOrDefault(m => m.Id == 2);

            Assert.Null(art);
        }
コード例 #3
0
        public IActionResult Delete([FromRoute] int id)
        {
            //Checking if deleting was performed successfully
            var result = _tripService.Delete(id);

            //Returning adequate status
            if (result)
            {
                return(NoContent());
            }
            else
            {
                return(NotFound());
            }
        }
コード例 #4
0
 public IActionResult Delete(string id)
 {
     try
     {
         ObjectId objectId      = new ObjectId(id);
         bool     deleteSuccess = _tripService.Delete(objectId);
         if (!deleteSuccess)
         {
             return(StatusCode(500));
         }
         return(Ok());
     }
     catch (Exception e)
     {
         return(StatusCode(500));
     }
 }
コード例 #5
0
ファイル: TripController.cs プロジェクト: HenryHYH/JBP
        public virtual IActionResult Delete(int id)
        {
            if (!permissionService.Authorize(StandardPermissionProvider.ManageTrips))
            {
                return(AccessDeniedView());
            }

            var entity = tripService.Get(id);

            if (null == entity || entity.Deleted)
            {
                return(RedirectToAction("List"));
            }

            tripService.Delete(entity);

            customerActivityService.InsertActivity("DeleteTrip",
                                                   string.Format(localizationService.GetResource("ActivityLog.DeleteTrip"), entity.Id),
                                                   entity);

            SuccessNotification(localizationService.GetResource("Admin.Logistics.Trip.Deleted"));

            return(RedirectToAction("List"));
        }
コード例 #6
0
 public IActionResult Delete(int id)
 {
     _tripService.Delete(id, User.Claims);
     return(Ok());
 }
コード例 #7
0
 public bool Delete(int id)
 {
     return(service.Delete(id));
 }
コード例 #8
0
 public IActionResult Delete(int id)
 {
     _service.Delete(id);
     return(Ok());
 }