public string FileUpload(HttpPostedFileBase file, int groupid) { string path = string.Empty; if (file != null) { string pageGroupTilte = pg.GetPageGroupById(groupid).GroupTitle; string fileName = Path.GetFileNameWithoutExtension(file.FileName) + "_" + Guid.NewGuid().ToString(); string extension = Path.GetExtension(file.FileName); path = "~/Images/Pages/" + pageGroupTilte + "/" + fileName + extension; file.SaveAs(Server.MapPath(path)); } return(path); }
// GET: AdminPanel/PageGroups/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PageGroup pageGroup = pg.GetPageGroupById(id.Value); if (pageGroup == null) { return(HttpNotFound()); } return(PartialView(pageGroup)); }