Exemplo n.º 1
0
 public JsonResult agregarCalificacion(DataCrearCalificacion dcc)
 {
     String tiendaId = Session["Tienda_Nombre"].ToString();
     try
     {
         Calificacion c = new Calificacion
         {
             ProductoID = dcc.ProductoID,
             UsuarioEvalua = dcc.UsuarioEvalua,
             UsuarioCalificado = dcc.UsuarioCalificado,
             puntaje = dcc.puntaje,
             comentario = dcc.comentario
         };
         uC.AgregarCalificacion(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);
     }
 }
Exemplo n.º 2
0
 //--CALIFICACIONES--
 public void AgregarCalificacion(Calificacion c, string idTienda)
 {
     try
     {
         if (c == null)
             throw new Exception("Debe pasar una calificación.");
         if (c.puntaje < 1 || c.puntaje > 5)
             throw new Exception("El puntaje debe ser entre 1 y 5.");
         chequearTienda(idTienda);
         using (var context = ChebayDBContext.CreateTenant(idTienda))
         {
             context.calificaciones.Add(c);
             context.SaveChanges();
         }
     }
     catch (Exception e)
     {
         Debug.WriteLine(e.Message);
         throw e;
     }
 }