예제 #1
0
        public HttpResponseMessage SignupForShiftDay(ShiftDaySignupInput input)
        {
            var shiftDay = _shiftsService.GetShiftDayById(input.ShiftDayId);

            if (shiftDay == null)
            {
                throw HttpStatusCode.NotFound.AsException();
            }

            if (shiftDay.Shift != null && shiftDay.Shift.DepartmentId != DepartmentId)
            {
                throw HttpStatusCode.Unauthorized.AsException();
            }

            _shiftsService.SignupForShiftDay(shiftDay.ShiftId, shiftDay.Day, input.GroupId, UserId);

            return(Request.CreateResponse(HttpStatusCode.Created));
        }