public ActionResult <Models.Response.ListaNegraResponse> Inserir([FromForm] Models.Request.ListaNegraRequest request) { try { Models.TbListaNegra tbLista = conversor.ConversorParaModeloTabela(request); if (request.Foto == null) { tbLista.DsFoto = "user.png"; } else { tbLista.DsFoto = gerenciadorFoto.GerarNovoNome(request.Foto.FileName); } business.Inserir(tbLista); if (request.Foto != null) { gerenciadorFoto.SalvarFoto(tbLista.DsFoto, request.Foto); } Models.Response.ListaNegraResponse resp = conversor.ConversorParaModeloResponse(tbLista); return(resp); } catch (System.Exception ex) { return(BadRequest(new Models.Response.ErroResponse( 400, ex.Message ))); } }
public Models.TbListaNegra ConversorParaModeloTabelaExcluir(Models.Response.ListaNegraResponse resp) { Models.TbListaNegra tbLista = new Models.TbListaNegra(); tbLista.IdListaNegra = resp.ID; tbLista.DtInclusao = resp.Inclusao; tbLista.DsMotivo = resp.Motivo; tbLista.NmPessoa = resp.Nome; return(tbLista); }
public Models.Response.ListaNegraResponse ParaResponse(Models.TbListaNegra ln) { Models.Response.ListaNegraResponse resp = new Models.Response.ListaNegraResponse(); resp.Id = ln.IdListaNegra; resp.Nome = ln.NmPessoa; resp.Motivo = ln.DsMotivo; resp.Inclusao = ln.DtInclusao; return(resp); }
public Models.Response.ListaNegraResponse ParaResponse(Models.TbListinhaNegra ln) { Models.Response.ListaNegraResponse resp = new Models.Response.ListaNegraResponse(); resp.Id = ln.IdListaNegra; resp.Nome = ln.NmIndividuo; resp.Motivo = ln.DsMotivo; resp.Inclusao = ln.DtInclusao; resp.Local = ln.DsLocal; resp.Foto = ln.DsFoto; return(resp); }
public Models.Response.ListaNegraResponse ConversorParaModeloResponse(Models.TbListaNegra tbLista) { Models.Response.ListaNegraResponse resp = new Models.Response.ListaNegraResponse(); resp.ID = tbLista.IdListaNegra; resp.Inclusao = tbLista.DtInclusao; resp.Motivo = tbLista.DsMotivo; resp.Nome = tbLista.NmPessoa; resp.Local = tbLista.DsLocal; resp.Foto = tbLista.DsFoto; resp.IdUsuario = tbLista.IdUsuario; return(resp); }
public ActionResult <Models.Response.ListaNegraResponse> Deletar(int id) { try { Models.TbListaNegra ln = business.Deletar(id); Models.Response.ListaNegraResponse resp = conversor.ParaResponse(ln); return(resp); } catch (System.Exception ex) { return(BadRequest( new Models.Response.ErroResponse(404, ex.Message) )); } }
public ActionResult <Models.Response.ListaNegraResponse> Alterar(int id, Models.Request.ListaNegraRequest request) { try { Models.TbListaNegra ln = conversor.ParaTabela(request); business.Alterar(id, ln); Models.Response.ListaNegraResponse resp = conversor.ParaResponse(ln); return(resp); } catch (System.Exception ex) { return(BadRequest( new Models.Response.ErroResponse(404, ex.Message) )); } }
public ActionResult <Models.Response.ListaNegraResponse> Inserir(Models.Request.ListaNegraRequest request) { try { Models.TbListaNegra ln = util.ParaTabela(request); buss.Salvar(ln); Models.Response.ListaNegraResponse resp = util.ParaResponse(ln); return(resp); } catch (System.Exception ex) { return(BadRequest( new Models.Response.ErroResponse(404, ex.Message) )); } }
public ActionResult <Models.Response.ListaNegraResponse> Inserir([FromForm] Models.Request.ListaNegraRequest request) { try { Models.TbListaNegra ln = conversor.ParaTabela(request); ln.DsFoto = gerenciadorFoto.GerarNovoNome(request.Foto.FileName); business.Salvar(ln); gerenciadorFoto.SalvarFoto(ln.DsFoto, request.Foto); Models.Response.ListaNegraResponse resp = conversor.ParaResponse(ln); return(resp); } catch (System.Exception ex) { return(BadRequest( new Models.Response.ErroResponse(404, ex.Message) )); } }