Exemple #1
0
        public async Task <bool> DeleteAsync(int id, int clientId, int userId)
        {
            if (!await _permissionManager.HasPermission(clientId, userId, Permission.CanDeleteShift))
            {
                throw new Exception("User has not permission to perform this operation");
            }

            return(await _shiftRepository.DeleteAsync(id));
        }
Exemple #2
0
        public async Task <ActionResult> Delete(Guid id)
        {
            try
            {
                var result = shiftRepo.Retrieve().FirstOrDefault(x => x.ShiftID == id);
                if (result == null)
                {
                    return(NotFound());
                }

                await shiftRepo.DeleteAsync(id);

                return(NoContent());
            }
            catch (Exception)
            {
                return(BadRequest());
            }
        }