Ejemplo n.º 1
0
        public void Update(UpdateTimeVideoCommand command)
        {
            if (!this.UpdateTimeVideoScopeIsValid(command))
            {
                return;
            }

            this.Time = command.Time;
        }
Ejemplo n.º 2
0
        public Task <HttpResponseMessage> Put(int id, [FromBody] dynamic body)
        {
            var command = new UpdateTimeVideoCommand(
                idTimeVideo: id,
                time: (int)body.time
                );

            var time = _service.Update(command);

            return(CreateResponse(HttpStatusCode.OK, time));
        }
Ejemplo n.º 3
0
        public TimeVideo Update(UpdateTimeVideoCommand command)
        {
            var time = _repository.GetById(command.IdTimeVideo);

            time.Update(command);
            _repository.Update(time);

            if (Commit())
            {
                return(time);
            }

            return(null);
        }
 public static bool UpdateTimeVideoScopeIsValid(this TimeVideo timeVideo, UpdateTimeVideoCommand newTimeVideo)
 {
     return(AssertionConcern.IsSatisfiedBy(
                AssertionConcern.AssertTrue(!(newTimeVideo.Time == 0), "O tempo é obrigatório")
                ));
 }