Beispiel #1
0
        public async Task <Response> UpdateShift(UpdateShiftModel shift)
        {
            var baseUrl = _serverUrl + "/api/shifts/Update";

            var response = await PutAsync <UpdateShiftModel>(baseUrl, shift);

            if (!response.IsSuccessStatusCode)
            {
                if (response.Content != null)
                {
                    var errorMsg = await response.Content.ReadAsStringAsync();

                    return(Response.Unsuccesfull(errorMsg));
                }
                return(Response.Unsuccesfull(response.ReasonPhrase));
            }

            return(Response.Succes());
        }
Beispiel #2
0
        public async Task <IActionResult> OnPostUpdateShiftWithUserAsync(User user, Shift shift)
        {
            if (shift.ShiftStart == null)
            {
                return(null); // More check and redirect to error page
            }

            //shift.EmployeeOnShift = user.Id;
            var shiftWithEmployee = new UpdateShiftModel()
            {
                EmployeeId = user.Id,
                ShiftId    = shift.id,
                ShiftStart = shift.ShiftStart,
                ShiftEnd   = shift.ShiftEnd
            };

            var result = await _shiftDataService.UpdateShift(shiftWithEmployee);

            return(RedirectToPage("/Calendar/Calendar_Index"));
        }