Ejemplo n.º 1
0
 public JsonResult agregarComentario(DatosCrearComentario datos)
 {
     try
     {
         String tiendaId = Session["Tienda_Nombre"].ToString();
         Comentario c = new Comentario
         {
             texto = datos.texto,
             fecha = datos.fecha,
             ProductoID = datos.prodId,
             UsuarioID = datos.userId
         };
         cS.AgregarComentario(c, tiendaId);
         var result = new { Success = "True" };
         return Json(result, JsonRequestBehavior.AllowGet);
     }
     catch (Exception e)
     {
         var result = new { Success = "False", Message = e.Message };
         return Json(result, JsonRequestBehavior.AllowGet);
     }
 }
Ejemplo n.º 2
0
 //--COMENTARIO--
 public void AgregarComentario(Comentario c, string idTienda)
 {
     try
     {
         if (c == null)
             throw new Exception("Debe pasar un comentario.");
         chequearTienda(idTienda);
         using (var context = ChebayDBContext.CreateTenant(idTienda))
         {
             context.comentarios.Add(c);
             context.SaveChanges();
         }
     }
     catch (Exception e)
     {
         Debug.WriteLine(e.Message);
         throw e;
     }
 }