public ActionResult ModifyNotice(int ModifyNoticeId, string ModifyNoticeTextarea) { using (var db = new kilicliogluEntities()) { db.notice.Find(ModifyNoticeId).text = ModifyNoticeTextarea; db.SaveChanges(); } return(RedirectToAction("notices", "admin")); }
// GET: Home public ActionResult Index() { using (var db = new kilicliogluEntities()) { IndexModel indexModel = new IndexModel(); indexModel.productList = db.product.OrderBy(x => x.indexOrder).ToList(); indexModel.noticeList = db.notice.ToList(); return(View(indexModel)); } }
public ActionResult CreateProduct(string name, string model, bool?availability, int?price, string imageSource, int?indexOrder, string details) { using (var db = new kilicliogluEntities()) { db.product.Add(new product { name = name, model = model, availability = availability ?? false, price = price, imageSource = imageSource, indexOrder = indexOrder, details = details }); db.SaveChanges(); } return(RedirectToAction("products", "admin")); }
public ActionResult CreateNotice(string CreateNoticeTextarea) { using (var db = new kilicliogluEntities()) { db.notice.Add(new notice { text = CreateNoticeTextarea }); db.SaveChanges(); } return(RedirectToAction("notices", "admin")); }
public ActionResult ProductDetails(int id) { DetailsModel detailsModel = new DetailsModel();; using (var db = new kilicliogluEntities()) { detailsModel.product = db.product.Find(id); detailsModel.noticeList = db.notice.ToList(); } return(View(detailsModel)); }
public ActionResult Login(string username, string password) { using (var db = new kilicliogluEntities()) { if (db.user.Any(u => u.username == username && u.password == password)) { Session["username"] = username; return(RedirectToAction("menu", "admin")); } Response.Write("Kullanıcı adı ve/veya şifre hatalı!"); return(View()); } }
public ActionResult ModifyNotice(int id) { if (Session["username"] == null) { return(RedirectToAction("login", "admin")); } notice n; using (var db = new kilicliogluEntities()) { n = db.notice.Find(id); } return(View(n)); }
public ActionResult Notices() { if (Session["username"] == null) { return(RedirectToAction("login", "admin")); } List <notice> notices; using (var db = new kilicliogluEntities()) { notices = db.notice.ToList(); } return(View(notices)); }
public ActionResult Products() { if (Session["username"] == null) { return(RedirectToAction("login", "admin")); } List <product> products; using (var db = new kilicliogluEntities()) { products = db.product.ToList(); } return(View(products)); }
public ActionResult DeleteProduct(int id) { if (Session["username"] == null) { return(RedirectToAction("login", "admin")); } product n; using (var db = new kilicliogluEntities()) { n = db.product.Find(id); db.product.Remove(n); db.SaveChanges(); } return(RedirectToAction("products", "admin")); }
public ActionResult ModifyProduct(int ModifyProductId, string name, string model, bool?availability, int?price, string imageSource, int?indexOrder, string details) { using (var db = new kilicliogluEntities()) { product p = db.product.Find(ModifyProductId); p.name = name; p.model = model; p.availability = availability ?? false; p.price = price; p.imageSource = imageSource; p.indexOrder = indexOrder; p.details = details; db.SaveChanges(); } return(RedirectToAction("products", "admin")); }
public ActionResult DeleteNotice(int id) { if (Session["username"] == null) { return(RedirectToAction("login", "admin")); } notice n; using (var db = new kilicliogluEntities()) { n = db.notice.Find(id); db.notice.Remove(n); db.SaveChanges(); } return(RedirectToAction("notices", "admin")); }
public ActionResult ModifyProduct(int id) { if (Session["username"] == null) { return(RedirectToAction("login", "admin")); } product n; using (var db = new kilicliogluEntities()) { n = db.product.Find(id); } ViewBag.Images = Directory.EnumerateFiles(Server.MapPath("~/img")) .Select(fn => Path.GetFileName(fn)); return(View(n)); }