예제 #1
0
 public static void InsertLog(LogModel log)
 {
     if (db.Any(l => l.Id == log.Id))
     {
         throw new Exception("Attempt to insert duplicate item in db!");
     }
     db.Add(log);
 }
예제 #2
0
        static RunnerLogDb()
        {
            db = new List<LogModel>();

            var log0 = new LogModel();
            log0.Id = 0;
            log0.RunDate = new DateTime(2015, 12, 31, 09, 00, 00);
            log0.Distance = 26;

            var log1 = new LogModel();
            log1.Id = 1;
            log1.RunDate = new DateTime(2016, 1, 3, 09, 30, 00);
            log0.Distance = 12;

            db.Add(log0);
            db.Add(log1);
        }
예제 #3
0
 public ActionResult InsertLog(LogModel log)
 {
     RunnerLogDb.InsertLog(log);
     return RedirectToAction("GetLog");
 }
예제 #4
0
 public ActionResult InsertLog()
 {
     LogModel log = new LogModel();
     log.RunDate = DateTime.Now;
     return View(log);
 }