public void SchedulingRepository_Update_ShouldBeOk()
        {
            Scheduling scheduling   = _repository.Get(1);
            DateTime   oldStartTime = scheduling.StartTime;

            scheduling.StartTime          = new DateTime(2018, 6, 10, 7, 0, 0);
            scheduling.Room.Disponibility = true;
            Scheduling result = _repository.Update(scheduling);

            result.Should().NotBeNull();
            result.Id.Should().BeGreaterThan(0);
            result.StartTime.Should().NotBe(oldStartTime);
        }
Esempio n. 2
0
        public void SchedulingSqlRepository_Update_ShouldBeOk()
        {
            //Cenário
            Scheduling scheduling   = _repository.Get(1);
            DateTime   oldStartTime = scheduling.StartTime;

            scheduling.StartTime = new DateTime(2018, 6, 10, 7, 0, 0);

            //Ação
            Scheduling result = _repository.Update(scheduling);

            //Verifica
            result.Should().NotBeNull();
            result.Id.Should().BeGreaterThan(0);
            result.StartTime.Should().NotBe(oldStartTime);
        }
Esempio n. 3
0
        public Scheduling Update(Scheduling entity)
        {
            try
            {
                var scheduling = Get(entity.SchedulingKey);

                if ((scheduling.Data != entity.Data || scheduling.Hora != entity.Hora) && _schedulingRepository.Exists(entity))
                {
                    throw new ForbbidenException("Scheduling already exists");
                }

                var address = _addressRepository.Get(entity.Address.AddressKey);
                entity.Address = address ?? throw new NotFoundException("New Address not found");

                return(_schedulingRepository.Update(entity));
            }
            catch (ForbbidenException ex)
            {
                throw new ForbbidenException($"Not was possible update the Scheduling: {ex.Message}");
            }
            catch (NotFoundException ex)
            {
                throw new NotFoundException($"Not was possible update the Scheduling: {ex.Message}");
            }
            catch (Exception ex)
            {
                throw new InternalServerErrorException($"Not was possible update the Scheduling: {ex.Message}");
            }
        }
        public void Put([FromBody] Scheduling value)
        {
            Scheduling scheduling = _schedulingRepository.GetById(value.ID);

            scheduling.STATUS = "C";
            _schedulingRepository.Update(scheduling);
        }
Esempio n. 5
0
 public Scheduling Update(Scheduling scheduling)
 {
     if (scheduling.Id < 1)
     {
         throw new IdentifierUndefinedException();
     }
     scheduling.Validate();
     return(_repository.Update(scheduling));
 }
Esempio n. 6
0
        public void Update(SchedulingViewModel fieldViewModel)
        {
            if (fieldViewModel.HoraryType != Domain.Others.Enum.HoraryType.Default)
            {
                fieldViewModel.HoraryExtraId = fieldViewModel.HoraryId;
                fieldViewModel.HoraryId      = null;
            }

            _schedulingRepository.Update(_mapper.Map <Scheduling>(fieldViewModel));
        }
Esempio n. 7
0
        public DTO.PutUpdateToDoDataResponse UpdateToDo(DTO.PutUpdateToDoDataRequest request)
        {
            PutUpdateToDoDataResponse response = new PutUpdateToDoDataResponse();
            ISchedulingRepository     repo     = Factory.GetRepository(request, RepositoryType.ToDo);
            bool success = (bool)repo.Update(request);

            if (success)
            {
                ToDoData data = (ToDoData)repo.FindByID(request.ToDoData.Id, true);
                response.ToDoData = data;
            }
            return(response);
        }
Esempio n. 8
0
        public async Task Delete(Guid id)
        {
            var scheduling = await _schedulingRepository.GetAsync(id);

            if (scheduling is null)
            {
                Notify("Dados do Agendamento não encontrado.");
                return;
            }

            scheduling.Delete();

            _schedulingRepository.Update(scheduling);

            if (await CommitAsync() is false)
            {
                Notify("Erro ao salvar dados.");
            }
        }
Esempio n. 9
0
        public PutUpdateToDoDataResponse UpdateToDo(PutUpdateToDoDataRequest request)
        {
            PutUpdateToDoDataResponse response = new PutUpdateToDoDataResponse();

            try
            {
                ISchedulingRepository repo = Factory.GetRepository(request, RepositoryType.ToDo);
                bool success = (bool)repo.Update(request);
                if (success)
                {
                    ToDoData data = (ToDoData)repo.FindByID(request.ToDoData.Id, true);
                    response.ToDoData = data;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(response);;
        }
Esempio n. 10
0
 public async void Update(long id, Scheduling scheduling)
 {
     await _schedulingRepository.Update(id, scheduling);
 }
 public void UpdateScheduling(Scheduling Scheduling, string userName)
 {
     Scheduling.DateUpdated       = DateTime.Now;
     Scheduling.UpdatedByUserName = userName;
     _schedulingRepository.Update(Scheduling);
 }