public IActionResult Create(Report report) { dbContext.Reports.Add(report); dbContext.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult CreateConfrim(Report report) { if (ModelState.IsValid) { db.Reports.Add(report); db.SaveChanges(); } return(Redirect("/")); }
public ActionResult Create(Report report) { if (this.ModelState.IsValid) { db.Reports.Add(report); db.SaveChanges(); return(Redirect("/")); } return(View(report)); }
public ActionResult Create(Report report) { using (var database = new LogNozirohDbContext()) { database.Reports.Add(report); database.SaveChanges(); return(Redirect("/")); } }
public ActionResult Create(Report report) { using (var context = new LogNozirohDbContext()) { context.Reports.Add(report); context.SaveChanges(); return(this.Redirect("/")); } }
public ActionResult DeleteConfirm(int id, Report reportModel) { using (var db = new LogNozirohDbContext()) { var RemReport = db.Reports.Find(id); db.Reports.Remove(RemReport); db.SaveChanges(); return(Redirect("/")); } }
public ActionResult DeleteConfirm(int id, Report reportModel) { using (var database = new LogNozirohDbContext()) { var report = database.Reports.Where(r => r.Id == id).First(); database.Reports.Remove(report); database.SaveChanges(); return(RedirectToAction("Index")); } }
public ActionResult DeleteConfirm(int id, Report reportModel) { using (var database = new LogNozirohDbContext()) { var reportFromDataBase = database.Reports.Find(id); database.Reports.Remove(reportFromDataBase); database.SaveChanges(); return(Redirect("/")); } }
public ActionResult Create(Report report) { if (ModelState.IsValid) { using (var database = new LogNozirohDbContext()) { database.Reports.Add(report); database.SaveChanges(); } } return(RedirectToAction("Index")); }
public ActionResult Create(Report report) { if (this.ModelState.IsValid) { using (var db = new LogNozirohDbContext()) { db.Reports.Add(report); db.SaveChanges(); } } return(Redirect("/")); }
public ActionResult Create(Report report) { if (!ModelState.IsValid) { return(View()); } using (var db = new LogNozirohDbContext()) { db.Reports.Add(report); db.SaveChanges(); return(RedirectToAction("Index")); } }
public ActionResult DeleteConfirm(int id, Report reportModel) { using (var db = new LogNozirohDbContext()) { var film = db.Reports.Find(id); if (film == null) { return(RedirectToAction("Index")); } db.Reports.Remove(film); db.SaveChanges(); return(RedirectToAction("Index")); } }
public ActionResult DeleteConfirm(int?id, Report reportModel) { using (var db = new LogNozirohDbContext()) { var reportFromDb = db.Reports.Find(id); if (reportFromDb == null) { return(HttpNotFound()); } db.Reports.Remove(reportFromDb); db.SaveChanges(); return(Redirect("/")); } }
public ActionResult Create(Report report) { if (report == null) { return(RedirectToAction("Index")); } if (string.IsNullOrWhiteSpace(report.Message) || string.IsNullOrWhiteSpace(report.Origin) || string.IsNullOrWhiteSpace(report.Status)) { ViewBag.message = "Попълни полетата!"; return(View(report)); } using (var db = new LogNozirohDbContext()) { db.Reports.Add(report); db.SaveChanges(); return(RedirectToAction("Index")); } }
public ActionResult DeleteConfirm(int id, Report reportModel) { if (id == null) { return(HttpNotFound()); } using (var database = new LogNozirohDbContext()) { Report reportToBeDeleted = database.Reports.Find(id); if (reportToBeDeleted == null) { return(RedirectToAction("Index")); } database.Reports.Remove(reportToBeDeleted); database.SaveChanges(); } return(RedirectToAction("Index")); }