public override System.Web.Mvc.ActionResult Edit(Models.Catalogue catalogue) { var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Edit); ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "catalogue", catalogue); EditOverride(callInfo, catalogue); return(callInfo); }
public virtual System.Web.Mvc.ActionResult DeleteConfirmed(System.Guid id) { Models.Catalogue oCatalogue = UnitOfWork.CatalogueRepository.Get() .Where(current => current.Id == id) .FirstOrDefault() ; UnitOfWork.CatalogueRepository.Delete(oCatalogue); UnitOfWork.Save(); return(RedirectToAction(MVC.Catalogue.AdminIndex())); }
public virtual System.Web.Mvc.ActionResult Edit(System.Guid id) { Models.Catalogue oCatalogue = UnitOfWork.CatalogueRepository.Get() .Where(current => current.Id == id) .FirstOrDefault() ; if (oCatalogue == null) { return(HttpNotFound()); } return(View(oCatalogue)); }
// GET: Catalogues/Details/5 public ActionResult Details(int?id) { if (string.IsNullOrEmpty(Session["Login"] as string)) { return(RedirectToAction("Index", "Login")); } if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Models.Catalogue catalogue = db.Catalogues.Find(id); if (catalogue == null) { return(HttpNotFound()); } return(View(catalogue)); }
public ActionResult DeleteConfirmed(int id) { if (string.IsNullOrEmpty(Session["Login"] as string)) { return(RedirectToAction("Index", "Login")); } Models.Catalogue catalogue = db.Catalogues.Find(id); System.Collections.ArrayList removeItems = new System.Collections.ArrayList(); System.Collections.ArrayList removeSubCata = new System.Collections.ArrayList(); foreach (Models.SubCatalogue subCata in catalogue.SubCatalogues) { foreach (Models.CatalogueItem item in subCata.CatalogueItems) { removeItems.Add(item); } removeSubCata.Add(subCata); } foreach (Models.CatalogueItem item in catalogue.CatalogueItems) { removeItems.Add(item); } foreach (Models.CatalogueItem item in removeItems) { db.CatalogueItems.Remove(item); } foreach (Models.SubCatalogue subCata in removeSubCata) { db.SubCatalogues.Remove(subCata); } db.Catalogues.Remove(catalogue); db.SaveChanges(); return(RedirectToAction("Index", "Home")); }
public virtual System.Web.Mvc.ActionResult Create(Models.Catalogue catalogue) { if (ModelState.IsValid) { if (Request.Files["FileName"].ContentLength > 0) { string directoryReal = string.Format("{0}/{1}", Server.MapPath("~/Content/userfiles"), Request.Files["FileName"].FileName); string filname = Request.Files["FileName"].FileName; Request.Files["FileName"].SaveAs(directoryReal); catalogue.FileName = filname; UnitOfWork.CatalogueRepository.Insert(catalogue); UnitOfWork.Save(); return(RedirectToAction(MVC.Catalogue.AdminIndex())); } } return(View(catalogue)); }
public ActionResult Create([Bind(Include = "CataID,UserID,Title,Priority,Description,DateCreated,DateModified")] Models.Catalogue catalogue) { if (string.IsNullOrEmpty(Session["Login"] as string)) { return(RedirectToAction("Index", "Login")); } if (ModelState.IsValid) { catalogue.CataID = db.Catalogues.Count <Models.Catalogue>() + 1; catalogue.UserID = int.Parse(Session["UserID"].ToString()); catalogue.DateCreated = DateTime.Now; catalogue.DateModified = DateTime.Now; db.Catalogues.Add(catalogue); db.SaveChanges(); return(RedirectToAction("Index", "Home")); } return(View(catalogue)); }
// GET: Catalogues/Edit/5 public ActionResult Edit(int?id) { if (string.IsNullOrEmpty(Session["Login"] as string)) { return(RedirectToAction("Index", "Login")); } if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Models.Catalogue catalogue = db.Catalogues.Find(id); if (catalogue == null) { return(HttpNotFound()); } Session["CataID"] = catalogue.CataID; Session["UserID"] = catalogue.UserID; Session["DateCreated"] = catalogue.DateCreated; return(View(catalogue)); }
partial void EditOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, Models.Catalogue catalogue);