public void Update(UpdateCategoryVideoCommand command)
        {
            if (!this.UpdateCategoryVideoScopeIsValid(command))
            {
                return;
            }

            this.Category = command.Category;
        }
        public Task <HttpResponseMessage> Put(int id, [FromBody] dynamic body)
        {
            var command = new UpdateCategoryVideoCommand(
                idCategoryVideo: id,
                category: (string)body.category
                );

            var category = _service.Update(command);

            return(CreateResponse(HttpStatusCode.OK, category));
        }
Пример #3
0
        public CategoryVideo Update(UpdateCategoryVideoCommand command)
        {
            var category = _repository.GetById(command.IdCategoryVideo);

            category.Update(command);
            _repository.Update(category);

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

            return(null);
        }
 public static bool UpdateCategoryVideoScopeIsValid(this CategoryVideo typeEquipment, UpdateCategoryVideoCommand newCategoryVideo)
 {
     return(AssertionConcern.IsSatisfiedBy(
                AssertionConcern.AssertNotEmpty(newCategoryVideo.Category, "A categoria é obrigatória"),
                AssertionConcern.AssertLength(newCategoryVideo.Category, 2, 15, "O tipo deve ter entre 2 e 15 caracters")
                ));
 }