public ActionResult MyAccount() { var db = new ImageDb(Properties.Settings.Default.ConStr); var images = db.GetUserImages(User.Identity.Name); return(View(images)); }
public ActionResult Delete(int id) { var db = new ImageDb(Properties.Settings.Default.ConStr); var imageIds = db.GetUserImages(User.Identity.Name).Select(i => i.Id); if (!imageIds.Contains(id)) { return(Redirect("http://www.google.com")); // go away.... } db.DeleteImage(id); return(RedirectToAction("MyAccount")); }