Exemplo n.º 1
0
        public ActionResult <EngMonarch> Post(EngMonarchInput model)
        {
            _logger.LogInformation($"Creating a new engmonarch with title \"{model.Name}\"");

            var engmonarch = new EngMonarch();

            model.MapToEngMonarch(engmonarch);

            _engmonarchRepository.CreateAsync(engmonarch);

            return(CreatedAtAction(nameof(GetById), "engmonarch", new { id = engmonarch.Id }, engmonarch));
        }
Exemplo n.º 2
0
        public async Task <ActionResult <EngMonarch> > Put(string id, EngMonarchInput model)
        {
            _logger.LogInformation($"Updating a engmonarch with id {id}");

            var engmonarch = await _engmonarchRepository.GetByIdAsync(id);

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

            model.MapToEngMonarch(engmonarch);

            _engmonarchRepository.UpdateAsync(engmonarch);

            return(engmonarch);
        }