Esempio n. 1
0
        public IActionResult GetShiftByDate(int id, [FromQuery] string date)
        {
            Shift getShiftByDate;

            if (date == null)
            {
                return(StatusCode((int)HttpStatusCode.BadRequest, "Please enter a date in order to see the shift"));
            }

            try
            {
                getShiftByDate = _repo.GetShiftByDate(id, date);
            }
            catch (Exception)
            {
                return(StatusCode((int)HttpStatusCode.InternalServerError,
                                  $"It does not appear that there is a shift for this employee on {date}"));
            }

            return(StatusCode((int)HttpStatusCode.OK, getShiftByDate));
        }