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 })); }
// 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")); } }
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; } }