public async Task <IActionResult> DeleteTrip(int id) { if (!_tripService.TripExists(id)) { return(NotFound()); } await _tripService.Delete(id); return(NoContent()); }
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); }
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()); } }
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)); } }
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")); }
public IActionResult Delete(int id) { _tripService.Delete(id, User.Claims); return(Ok()); }
public bool Delete(int id) { return(service.Delete(id)); }
public IActionResult Delete(int id) { _service.Delete(id); return(Ok()); }