示例#1
0
        public virtual Task <IActionResult> Put(long id, [FromBody] TViewModel model)
        {
            Throw.IfIsNull(id, this._localizer["campoNulo", nameof(id)]);
            Throw.IfLessThanOrEqZero(id, this._localizer["menorOuIgual", nameof(id), "zero"]);
            Throw.IfIsNull(model, this._localizer["campoNulo", nameof(model)]);

            var result = Mapper.Map <TViewModel>(_application.Update(model.Model()));

            return(Task.FromResult <IActionResult>(Ok(result)));
        }
示例#2
0
        public IActionResult Update([FromBody] TEntityDTO data)
        {
            try
            {
                if (data == null)
                {
                    throw new Exception("Dados de entradas incorretos.");
                }

                _app.Update(data);
                return(Ok(true));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }