public ActionResult ClientView(HttpPostedFileBase archivo, string Hoja) { if(!archivo.Equals(null)) { return View(ToEntidadHojaExcelList(archivo)); } return View(); }
public ActionResult Index(HttpPostedFileBase archivo, string Hoja) { try { if (!archivo.Equals(null)) { return View(ToEntidadHojaExcelList(archivo)); } return View(); } catch (Exception ex) { return View("Error"); } }
public ActionResult UserPost(string fullname, string description, string address, HttpPostedFileBase pic) { var sessionUser=(tbluser)Session["isLoggedIn"]; var user = db.tblusers.SingleOrDefault(x => x.ID == (sessionUser.ID)); user.userFullName = fullname; user.userDescription = description; user.userAddress = address; if (pic != null && pic.ContentLength > 0) if (!pic.Equals("/Images/DefUser.png")) { var fileName = Path.GetFileName(pic.FileName); // store the file inside ~/App_Data/uploads folder var pathName = ("~/userImg/" + user.ID); System.IO.Directory.CreateDirectory(Server.MapPath(pathName)); var path = Path.Combine(Server.MapPath(pathName), fileName); pic.SaveAs(path); user.userPicture = "/userImg/" + user.ID + "/" + fileName; } db.SaveChanges(); return RedirectToAction("PortfolioEdit"); }