Ejemplo n.º 1
0
        public JsonResult InfoWorkShop(int Orden)
        {
            List <ResultWorkshop> lista = null;
            bool error     = false;
            var  resultado = (dynamic)null;

            try
            {
                Workshop workshop = new Workshop();

                lista = workshop.infoWorkShop(Orden);

                if (lista != null)
                {
                    foreach (var item in lista)
                    {
                        resultado = new Framework.Libraies.ResultWorkshop {
                            IdWorkshop = item.IdWorkshop, Name = item.Name, Address = item.Address, Phone = item.Phone, Email = item.Email, WorkImage = item.WorkImage
                        };
                    }
                    error = false;
                }
                else
                {
                    error = true;
                }
            }
            catch (Exception ex)
            {
                throw;
            }

            return(Json(new { error, resultado }));
        }
Ejemplo n.º 2
0
        // GET: Workshop
        public ActionResult Index()
        {
            string path = Request.Url.AbsolutePath;

            ViewBag.ReturnUrl = path;
            Users        us       = new Users();
            ShoppingCart sh       = new ShoppingCart();
            Workshop     ws       = new Workshop();
            var          UserData = (dynamic)null;
            var          idUser   = Security.GetIdUser(this);
            var          usuario1 = User.Identity.Name;
            var          pro      = (dynamic)null;

            if (usuario1 != "")
            {
                var id = sh.User(usuario1);
                UserData = ws.Workshopinfo(id);
                if (UserData != null)
                {
                    foreach (var item in UserData)
                    {
                        pro = new Framework.Libraies.ResultWorkshop
                        {
                            Name       = item.Name,
                            Address    = item.Address,
                            Phone      = item.Phone,
                            ZipCode    = item.ZipCode,
                            WorkImage  = item.WorkImage,
                            IdWorkshop = item.IdWorkshop
                        };
                    }
                }
                else
                {
                    return(RedirectToAction("Index", "Home"));
                }
                return(View(pro));
            }
            else
            {
                return(RedirectToAction("Index", "Home"));
            }
        }
Ejemplo n.º 3
0
 public JsonResult UpdateWorkshopData(string zipcore, string name, string address, string mobile, string idwo)
 {
     try
     {
         List <ResultWorkshop> user = null;
         var    b      = (dynamic)null;
         string idUser = System.Web.HttpContext.Current.Session["SessionUser"] as String;
         if (idUser != null && idUser != "")
         {
             Workshop us     = new Workshop();
             var      update = us.UpdateWorkshopData(zipcore, name, address, mobile, idUser, idwo);
             if (update == true)
             {
                 user = us.dataworkshop(idUser);
                 foreach (var item in user)
                 {
                     b = new Framework.Libraies.ResultWorkshop {
                         ZipCode = item.ZipCode, Name = item.Name, Address = item.Address, Phone = item.Phone
                     };
                 }
                 return(Json(b, JsonRequestBehavior.AllowGet));
             }
             else
             {
                 return(Json(new { Success = false }));
             }
         }
         else
         {
             return(Json(new { Success = false }));
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }