Example #1
0
        public Task <ControleViewModel> GiveBack(DevolucaoViewModel vm)
        {
            var controle = _context.Controles.Find(vm.Codigo);

            controle.FuncionarioDevolucao = _context.Funcionarios.Find(vm.FuncionarioID);
            controle.UsuarioDevolucao     = CurrentUser;
            controle.Devolucao            = vm.Data;

            _context.Controles.Update(controle);
            _context.SaveChanges();

            return(Task.FromResult(_mapper.Map <ControleViewModel>(controle)));
        }
Example #2
0
        public async Task <IActionResult> Devolver(DevolucaoViewModel vm)
        {
            try
            {
                var result = await _controleService.GiveBack(vm);

                return(Ok(result));
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }