コード例 #1
0
 public ActionResult <Models.Response.AnuncioRoupasResponse.Anuncio> Anunciar([FromForm] Models.Request.AnuncioRoupasRequest.Anunciar anuncio)
 {
     try
     {
         Models.TbAnuncio anu1 = conversorAnuncio.AnuncioParaTabela(anuncio);
         anu1.TbImagem = gerenciadorImagem.GerarMuitosNomes(anuncio.Imagens);
         Models.TbAnuncio resp = businessAnuncio.Anunciar(anu1);
         gerenciadorImagem.SalvarVariasImagens(anuncio.Imagens, resp.TbImagem.ToList());
         return(conversorAnuncio.AnuncioParaResponse(resp));
     }
     catch (System.Exception ex)
     {
         return(BadRequest(new Models.Response.Erro(400, ex.Message)));
     }
 }
コード例 #2
0
 public Models.TbAnuncio AnuncioParaTabela(Models.Request.AnuncioRoupasRequest.Anunciar anuncio)
 {
     Models.TbAnuncio resp = new Models.TbAnuncio();
     resp.IdUsuario          = anuncio.IdUsuario;
     resp.NmMarca            = anuncio.Marca.Trim();
     resp.TpProduto          = anuncio.TipoDoProduto.Trim();
     resp.VlPreco            = anuncio.Preco;
     resp.BtVendido          = false;
     resp.DsCep              = anuncio.CEP.Trim();
     resp.DsCidade           = anuncio.Cidade.Trim();
     resp.DsCondicao         = anuncio.Condicao.Trim();
     resp.DsDescricao        = anuncio.Descricao.Trim();
     resp.DsEstado           = anuncio.Estado.Trim();
     resp.DsGenero           = anuncio.Genero.Trim();
     resp.DsSituacao         = "Publicado";
     resp.DsTamanho          = anuncio.Tamanho.Trim();
     resp.DsTitulo           = anuncio.Titulo.Trim();
     resp.DtPublicacao       = DateTime.Now;
     resp.TbPerguntaResposta = new List <Models.TbPerguntaResposta>();
     resp.TbImagem           = new List <Models.TbImagem>();
     return(resp);
 }