예제 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            AboutDescription aboutDescription = db.AboutDescriptions.Find(id);

            db.AboutDescriptions.Remove(aboutDescription);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #2
0
        // GET: Admin/AboutDescriptions/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            AboutDescription aboutDescription = db.AboutDescriptions.Find(id);

            if (aboutDescription == null)
            {
                return(HttpNotFound());
            }
            return(View(aboutDescription));
        }
예제 #3
0
        public ActionResult Create([Bind(Include = "AboutID,Image,Title,Description")] AboutDescription aboutDescription, HttpPostedFileBase imgUp)
        {
            if (ModelState.IsValid)
            {
                if (imgUp != null)
                {
                    aboutDescription.Image = Guid.NewGuid().ToString() + Path.GetExtension(imgUp.FileName);
                    imgUp.SaveAs(Server.MapPath("/Images/AboutImages/" + aboutDescription.Image));
                }
                teamAboutRepository.InsertAbout(aboutDescription);
                teamAboutRepository.Save();
                return(RedirectToAction("Index"));
            }

            return(View(aboutDescription));
        }