public ActionResult ReportDenunciar(DetalleCategoryModel detalle, int id) { var clas = _readOnlyRepository.GetById <Classified>(id); var usuario = _readOnlyRepository.GetById <User>(clas.IdUsuario); MailService.SendReportMessageToAdmin(usuario.Nombre, detalle.Categoria, clas.Id); this.AddNotification("Se ha enviado la denuncia.", NotificationType.Success); return(RedirectToAction("DetalleCategory", new { id })); }
public ActionResult DetalleCategory(DetalleCategoryModel detalle) { if (ModelState.IsValid) { var contt = new ContactUserInfo { Nombre = detalle.Nombre, Correo = detalle.Correo, Mensaje = detalle.Mensaje }; _writeOnlyRepository.Create(contt); var clas = _readOnlyRepository.GetById <Classified>(detalle.IdClasificado); detalle.Usuario = _readOnlyRepository.GetById <User>(clas.IdUsuario); MailService.SendContactMessageToUser(detalle.Correo, detalle.Nombre, detalle.Mensaje, detalle.Usuario.Correo); TwilioService.SendSms(detalle.Mensaje, detalle.Correo, detalle.Nombre, clas.Titulo); this.AddNotification("Se ha enviado el mensaje.", NotificationType.Success); return(RedirectToAction("DetalleCategory", detalle.IdClasificado)); } this.AddNotification("No se pudo enviar mensaje a vendedor.", NotificationType.Warning); return(RedirectToAction("DetalleCategory", detalle.IdClasificado)); }
public ActionResult DetalleCategory(int id) { if (id == 0) { this.AddNotification("Error al mostrar objeto!", NotificationType.Warning); return(RedirectToAction("CategoryInfo")); } var detalle = _readOnlyRepository.GetById <Classified>(id); detalle.Visitas += 1; _writeOnlyRepository.Update(detalle); var detail = new DetalleCategoryModel { IdClasificado = detalle.Id, Archived = detalle.Archived, IdUsuario = detalle.IdUsuario, Categoria = detalle.Categoria, FechaCreacion = detalle.FechaCreacion, Descripcion = detalle.Descripcion, Negocio = detalle.Negocio, Precio = detalle.Precio, Recomendado = detalle.Recomendado, Titulo = detalle.Titulo, Visitas = detalle.Visitas }; const string defaultUrl = "http://www.theinvestigativemusicologist.com/image.axd?picture=2012%2F7%2Fcreative-commons-public-domain.png"; ValidarCampos(detalle, detail, defaultUrl); if (detail.UrlVideo != "none") { detail.UrlVideo = detail.UrlVideo.Replace("watch?v=", "embed/"); } detail.Usuario = _readOnlyRepository.GetById <User>(detail.IdUsuario); return(View(detail)); }
private void ValidarCampos(Classified detalle, DetalleCategoryModel detail, string defaultUrl) { switch (RemoteFileExists(detalle.UrlImg0)) { case true: detail.UrlImg0 = detalle.UrlImg0; break; case false: detail.UrlImg0 = defaultUrl; break; } switch (RemoteFileExists(detalle.UrlImg1)) { case true: detail.UrlImg1 = detalle.UrlImg1; break; case false: detail.UrlImg1 = defaultUrl; break; } switch (RemoteFileExists(detalle.UrlImg2)) { case true: detail.UrlImg2 = detalle.UrlImg2; break; case false: detail.UrlImg2 = defaultUrl; break; } switch (RemoteFileExists(detalle.UrlImg3)) { case true: detail.UrlImg3 = detalle.UrlImg3; break; case false: detail.UrlImg3 = defaultUrl; break; } switch (RemoteFileExists(detalle.UrlImg4)) { case true: detail.UrlImg4 = detalle.UrlImg4; break; case false: detail.UrlImg4 = defaultUrl; break; } switch (RemoteFileExists(detalle.UrlImg5)) { case true: detail.UrlImg5 = detalle.UrlImg5; break; case false: detail.UrlImg5 = defaultUrl; break; } switch (RemoteFileExists(detalle.UrlVideo)) { case true: detail.UrlVideo = detalle.UrlVideo; break; case false: detail.UrlVideo = "none"; break; } }