Exemplo n.º 1
0
        public virtual IActionResult DeleteConsignmentOrder(int id, int tripId)
        {
            if (!permissionService.Authorize(StandardPermissionProvider.ManageTrips))
            {
                return(AccessDeniedView());
            }

            var entity = tripService.Get(tripId)
                         ?? throw new ArgumentException("Not found");

            var entityItem = entity.Orders.FirstOrDefault(x => x.Id == id)
                             ?? throw new ArgumentException("Not found");

            tripService.DeleteConsignmentOrder(entityItem);

            return(new NullJsonResult());
        }