Example #1
0
        public async Task <Result> InsertAsync(Maintenance maintenance)
        {
            try
            {
                await _maintenanceRepository.InsertAsync(maintenance);

                return(new Result());
            }
            catch (Exception ex)
            {
                return(new Result("Erro ao inserir ativo"));
            }
        }
Example #2
0
        public async Task <PopularResult <string> > InsertAsync(MaintenanceDto dto)
        {
            var result      = new PopularResult <string>();
            var entity      = ObjectMapper.Map <MaintenanceDto, MaintenanceEntity>(dto);
            var maintenance = await _maintenanceRepository.InsertAsync(entity);

            if (maintenance == null)
            {
                result.Failed("添加失败");
                return(result);
            }
            result.Success("添加成功");
            return(result);
        }