public ActionResult Index()
 {
     using (var db = new LogNozirohDbContext())
     {
         return(View(db.Reports.ToList()));
     }
 }
예제 #2
0
 public ActionResult Delete(int id)
 {
     using (var database = new LogNozirohDbContext())
     {
         var report = database.Reports.Find(id);
         return(View(report));
     }
 }
예제 #3
0
 public ActionResult Delete(int id)
 {
     using (var database = new LogNozirohDbContext())
     {
         var report = database.Reports.Where(r => r.Id == id).First();
         return(View(report));
     }
 }
예제 #4
0
 public ActionResult Index()
 {
     using (var db = new LogNozirohDbContext())
     {
         List <Report> reports = db.Reports.ToList();
         return(View(reports));
     }
 }
예제 #5
0
 public ActionResult Index()
 {
     using (var database = new LogNozirohDbContext())
     {
         var reports = database.Reports.ToList();
         return(View(reports));
     }
 }
예제 #6
0
 public ActionResult Delete(int id)
 {
     using (var db = new LogNozirohDbContext())
     {
         var RemReport = db.Reports.Find(id);
         return(View(RemReport));
     }
 }
        public ActionResult Delete(int id)
        {
            using (var db = new LogNozirohDbContext())
            {
                Report reportFromDb = db.Reports.Find(id);

                return(View(reportFromDb));
            };
        }
예제 #8
0
 public ActionResult Create(Report report)
 {
     using (var database = new LogNozirohDbContext())
     {
         database.Reports.Add(report);
         database.SaveChanges();
         return(Redirect("/"));
     }
 }
예제 #9
0
        public ActionResult Create(Report report)
        {
            using (var context = new LogNozirohDbContext())
            {
                context.Reports.Add(report);
                context.SaveChanges();

                return(this.Redirect("/"));
            }
        }
예제 #10
0
 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("/"));
     }
 }
예제 #11
0
 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 Details(int id)
        {
            using (var db = new LogNozirohDbContext())
            {
                var report = db.Reports
                             .Where(a => a.Id == id)
                             .First();

                return(View(report));
            }
        }
예제 #13
0
        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 IActionResult Delete(int id)
 {
     using (var db = new LogNozirohDbContext())
     {
         var report = db.Reports.Find(id);
         if (report != null)
         {
             return(View(report));
         }
     }
     return(Redirect("/"));
 }
 public ActionResult Details(int id)
 {
     using (var db = new LogNozirohDbContext())
     {
         var report = db.Reports.Find(id);
         if (report == null)
         {
             return(RedirectToAction("Index"));
         }
         return(View(report));
     }
 }
예제 #16
0
 public ActionResult Create(Report report)
 {
     if (ModelState.IsValid)
     {
         using (var database = new LogNozirohDbContext())
         {
             database.Reports.Add(report);
             database.SaveChanges();
         }
     }
     return(RedirectToAction("Index"));
 }
예제 #17
0
        public ActionResult Create(Report report)
        {
            if (this.ModelState.IsValid)
            {
                using (var db = new LogNozirohDbContext())
                {
                    db.Reports.Add(report);
                    db.SaveChanges();
                }
            }

            return(Redirect("/"));
        }
        public ActionResult Details(int id)
        {
            using (LogNozirohDbContext db = new LogNozirohDbContext())
            {
                Report report = db.Reports.Where(a => a.Id == id).First();

                if (report == null)
                {
                    return(HttpNotFound());
                }

                return(View(report));
            }
        }
        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"));
     }
 }
예제 #21
0
        public ActionResult Delete(int id)
        {
            if (id == null)
            {
                return(HttpNotFound());
            }
            using (var database = new LogNozirohDbContext())

            {
                Report report = database.Reports.Find(id);
                if (report == null)
                {
                    return(RedirectToAction("Index"));
                }
                return(View(report));
            }
        }
예제 #22
0
        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("/"));
            }
        }
예제 #23
0
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(HttpNotFound());
            }

            using (var db = new LogNozirohDbContext())
            {
                var report = db.Reports.Find(id);

                if (report == null)
                {
                    return(HttpNotFound());
                }

                return(View(report));
            }
        }
 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"));
     }
 }
예제 #25
0
        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"));
        }
        public ActionResult Details(int id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            using (var db = new LogNozirohDbContext())
            {
                var rep = db.Reports
                          .Where(a => a.Id == id)
                          .First();


                if (rep == null)
                {
                    return(HttpNotFound());
                }

                return(View(rep));
            }
        }
 public ReportController(LogNozirohDbContext dbContext)
 {
     this.dbContext = dbContext;
 }
예제 #28
0
 public ReportController()
 {
     this.context = new LogNozirohDbContext();
 }