//About Us Page public ActionResult About() { Session["menu"] = 3; var ls = new AboutUsDao(_provider).GetAll().Where(w => w.AboutHide == false).ToList(); return(View(ls)); }
public ActionResult Edit(AboutUsDTO aboutUs) { //get Image have exist var currentFileName = new AboutUsDao(_unitOfWork).GetByid(aboutUs.ID).AboutImage; //check name have deafault if exist ==> dont delete if (aboutUs.FileImage == null) { aboutUs.AboutImage = currentFileName; } else { //delete file var filePath = Server.MapPath(path + currentFileName); if (System.IO.File.Exists(filePath)) { System.IO.File.Delete(filePath); } aboutUs.AboutImage = DateTime.Now.Ticks + Path.GetFileName(aboutUs.FileImage.FileName); aboutUs.FileImage.SaveAs(Server.MapPath(path + aboutUs.AboutImage)); aboutUs.FileImage = null; } var data = new AboutUsDao(_unitOfWork).GetByid(aboutUs.ID); if (!ModelState.IsValid) { return(View(data)); } if (new AboutUsDao(_unitOfWork).Edit(aboutUs)) { return(RedirectToAction("Index")); } TempData[MessageConst.ERROR] = "Edit Failed"; return(View(data)); }
public ActionResult Edit(int id) { var data = new AboutUsDao(_unitOfWork).GetByid(id); if (data == null) { return(RedirectToAction("Page404", "Error")); } return(View(data)); }
// GET: Admin/AboutUs //Display List About us public ActionResult Index() { var data = new AboutUsDao(_unitOfWork).GetAll(); return(View(data)); }