public Models.TbMemelation ForTable(Models.Request.MemeRequest req) { return(new Models.TbMemelation { DtInclusao = DateTime.Now, DsCategoria = req.categoria, DsHashtags = req.hashtags.Replace("#", ""), NmAutor = req.autor, BtMaior = req.maior }); }
public Models.TbMemelation ParaTabela(Models.Request.MemeRequest req) { Models.TbMemelation tb = new Models.TbMemelation(); tb.NmAutor = req.Autor; tb.DsCategoria = req.Categoria; tb.DsHashtags = req.Hashtags; tb.BtMaior = req.Maior; tb.DtInclusao = DateTime.Now; return(tb); }
public ActionResult <Models.Response.MemeResponse> Alterar(int id, [FromForm] Models.Request.MemeRequest req) { try { Models.TbMemelation tb = conversor.ParaTabela(req); Models.TbMemelation novaTb = business.Alterar(id, tb); return(conversor.ParaResponse(novaTb)); } catch (Exception ex) { return(BadRequest( new Models.Response.ErroResponse(400, ex.Message) )); } }
public ActionResult <Models.Response.MemeResponse> alterar(int id, [FromForm] Models.Request.MemeRequest req) { try { Models.TbMemelation meme = conv.ForTable(req); meme.DsImagem = gerenciadorFoto.GerarNovoNome(req.imagem.FileName); meme = buss.alterar(id, meme); gerenciadorFoto.SalvarFoto(meme.DsImagem, req.imagem); return(conv.ForResponse(meme)); } catch (Exception ex) { return(new BadRequestObjectResult( new Models.Response.ErroResponse(400, ex.Message) )); } }
public ActionResult <Models.Response.MemeResponse> Alterar(int id, [FromForm] Models.Request.MemeRequest req) { try { Models.TbMemelation tb = conversor.ParaTabela(req); tb.ImgMeme = gerenciadorFoto.GerarNovoNome(req.Imagem.FileName); Models.TbMemelation novaTb = business.Alterar(id, tb); gerenciadorFoto.SalvarFoto(novaTb.ImgMeme, req.Imagem); return(conversor.ParaResponse(novaTb)); } catch (Exception ex) { return(BadRequest( new Models.Response.ErroResponse(400, ex.Message) )); } }