Example #1
0
        public void SetUsedTime(int id)
        {
            var serif = db.Serifs.Find(id);

            serif.LastUsedTime    = DateTime.Now;
            db.Entry(serif).State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();
        }
Example #2
0
        protected override void Seed(Context.SerifDataContext context)
        {
            //var serifCSV = CSVRead.getSerifCSV(
            //    @"none");


            //foreach (var serifData in serifCSV)
            //{
            //    context.Serifs.AddOrUpdate(p => p.Id,
            //    new Models.SerifData
            //    {
            //        /*Id = lastId,*/
            //        Name = serifData.Name,
            //        Text = serifData.Text,
            //        LastUsedTime = null,
            //        Type = serifData.Type
            //    });
            //}

            context.SaveChanges();

            /*try { }
             * catch (System.Data.Entity.Validation.DbEntityValidationException e)
             * {
             *  foreach (var er in e.EntityValidationErrors)
             *  {
             *      foreach (var item in er.ValidationErrors)
             *      {
             *          string logmes = $"{item.PropertyName}:{item.ErrorMessage}";
             *          System.Diagnostics.Trace.WriteLine(logmes);
             *          System.Console.WriteLine(logmes);
             *      }
             *  }
             *  throw e;
             * }*/
        }