Ejemplo n.º 1
0
        public async Task UpdateAsync(Guid id, string name)
        {
            var @producer = await _producerRepository.GetOrFailAsync(id);

            @producer.SetName(name);
            await _producerRepository.UpdateAsync(@producer);
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Put(int id, [FromBody] ProducerModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var producer = await _producerRepository.GetAsync(id);

            if (producer == null)
            {
                return(NotFound());
            }

            producer.Name = model.Name;
            producer.Sex  = model.Sex;
            producer.DOB  = model.DOB;
            producer.BIO  = model.BIO;

            await _producerRepository.UpdateAsync(producer);

            return(Ok(producer));
        }