private void SaveExecute(IClosable window) { var vacationToAdd = new VacationToAdd { UserId = (int)SelectedUserId, VacationTypeId = (int)SelectedVacationTypeId, StartDate = (DateTime)StartDate, EndDate = (DateTime)EndDate, Comment = Comment }; try { _vacationService.AddVacation(vacationToAdd); Messenger.Default.Send <VacationToAdd>(vacationToAdd); if (window != null) { window.Close(); } } catch (VacationException exc) { CustomMessageBox.CustomMessageBox.Show(exc.Message, "Błąd"); } }
public SaveStatus AddVacation(VacationsModel vacationData, out int vacationID) { vw_VacationData VD = new vw_VacationData(); VD.ID = vacationData.ID; VD.VacationName = vacationData.Name; VD.VacationFrom = vacationData.FromDate; VD.VacationTo = vacationData.EndDate; //int vacationID; return(VacationService.AddVacation(VD, out vacationID)); }
public async Task <ActionResult <Vacation> > PostVacation(Vacation vacation) { /**to validate if balance is positive**/ if (_vacationService.VacationValidationPost(vacation)) { return(BadRequest()); } _vacationService.AddVacation(vacation); _vacationService.SaveVacation(); return(CreatedAtAction("GetVacation", new { id = vacation.ID }, vacation)); }
public async Task <Vacation> AddVacation(Vacation vacation) { try { if (_userViewModel.IsLogin) { var vac = await _vacationService.AddVacation(vacation); Vacation.Add(vac); OnPropertyChanged(nameof(Vacation)); return(vac); } return(null); } catch (VTSException e) { throw new BusinessException("Can't add vacation", e); } }