Пример #1
0
        public IHttpActionResult CancelLeaveRequest(int?id)
        {
            if (_leaveRequestRepository.GetLeaveRequestById(id) == null)
            {
                return(NotFound());
            }
            var  employeeId = User.Identity.GetUserId();
            bool result     = _leaveRequestRepository.DeleteLeaveRequest(id, employeeId);

            try
            {
                if (!result)
                {
                    throw new Exception();
                }
                return(Ok());
            }
            catch (Exception)
            {
                return(BadRequest());
            }
        }