public IServiceActionResult CreateTipoInsumo(TipoInsumoEntity tipoInsumoEntity) { tipoInsumoEntity.Validate(); if (tipoInsumoEntity.Invalid) { return(new ServiceActionResult(false, "Algo deu errado ao incluir!", tipoInsumoEntity.Notifications)); } var tipoInsumoNew = new TipoInsumoEntity ( tipoInsumoEntity.descricao_tp_insumo, // tipoInsumoEntity.qtd_dias_manut_prev, //validar essa data!!!! pq o tipo do insumo define os dias de manut do insumo? DateTime.Now, tipoInsumoEntity.user ); _tipoInsumoRepository.Create(tipoInsumoNew); var tipoInsumo = _tipoInsumoRepository.GetById(tipoInsumoNew.Id); if (tipoInsumo == null) { return(new ServiceActionResult(false, "Algo deu errado ao incluir!", null)); } return(new ServiceActionResult(true, "Tipo de Insumo criado!", tipoInsumo)); }
public TipoInsumoEntity GetById( Guid id, [FromServices] ITipoInsumoRepository repository ) { return(repository.GetById(id)); }