Пример #1
0
 public ActionResult AddPropuesta(Pedido_Propuesta obj)
 {
     if (!this.currentUser())
     {
         return(RedirectToAction("Ingresar", "Login"));
     }
     if (esUsuario())
     {
         return(RedirectToAction("Index", "Alertas"));
     }
     try
     {
         if (ModelState.IsValid)
         {
             if (dal.UpdatePropuesta(obj))
             {
                 return(RedirectToAction("Index", "Notificaciones"));
             }
         }
     }
     catch (Exception ex)
     {
         throw;
     }
     TempData["Propuesta"] = obj;
     return(RedirectToAction("Index"));
 }
Пример #2
0
 public bool AddPropuesta(Pedido_Propuesta obj)
 {
     using (var context = getContext())
     {
         context.Pedido_Propuesta.Add(obj);
         context.SaveChanges();
         return(true);
     }
 }
Пример #3
0
 public bool UpdatePropuesta(Pedido_Propuesta obj)
 {
     using (var context = getContext())
     {
         Pedido_Propuesta Pedido_Propuesta = context.Pedido_Propuesta.Where(x => x.IdPedido == obj.IdPedido && x.IdNegocio == obj.IdNegocio).SingleOrDefault();
         if (Pedido_Propuesta != null)
         {
             Pedido_Propuesta.Cantidad = obj.Cantidad;
             Pedido_Propuesta.Precio   = obj.Precio;
             context.SaveChanges();
             return(true);
         }
         return(false);
     }
 }
Пример #4
0
        public ActionResult Propuesta(int id)
        {
            if (!this.currentUser())
            {
                return(RedirectToAction("Ingresar", "Login"));
            }
            if (esUsuario())
            {
                return(RedirectToAction("Index", "Alertas"));
            }
            try
            {
                Usuarios user = getCurrentUser();

                Negocio_DAL negocioDal = new Negocio_DAL();
                ViewBag.lstNegocios  = negocioDal.GetNegociosByUserId(user.id_Usuario);
                ViewBag.lstProductos = new List <Negocio_Producto>();

                Pedido_Propuesta obj = new Pedido_Propuesta();
                if (id > 0)
                {
                    obj = dal.GetPropuesta(id);
                    //obj.IdNegocio = user.id_Usuario;

                    if (obj.IdNegocio > 0)
                    {
                        ViewBag.lstProductos = negocioDal.GetProductos(obj.IdNegocio);
                    }
                    return(View(obj));
                }
                return(View(obj));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }