예제 #1
0
        public ActionResult Save([FromBody] ClientesSaveDto model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            var result = _services.Post(model);

            return(Ok(result));
        }
예제 #2
0
        public OperationResult <ClientesEntity> Put(ClientesSaveDto model)
        {
            var result = new OperationResult <ClientesEntity>();

            try
            {
                var modelo = _mapper.Map <ClientesEntity>(model);
                _services.Clientes.Update(modelo);
                _services.SaveChanges();
                result.Success      = true;
                result.ResultObject = modelo;
            }
            catch (Exception ex)
            {
                result.Success = false;
                throw ex;
            }
            return(result);
        }