Exemple #1
0
 public virtual void Delete(SysEventViewModel sys, ModelStateDictionary modelState)
 {
     var entity = sys.ToEntity();
     db.SysEvents.Attach(entity);
     db.SysEvents.Remove(entity);
     db.SaveChanges();
 }
Exemple #2
0
        public virtual void Insert(SysEventViewModel sys, ModelStateDictionary modelState)
        {
            if (ValidateModel(sys, modelState))
            {
                if (string.IsNullOrEmpty(sys.Message))
                {
                    sys.Message = "";
                }

                var entity = sys.ToEntity();

                db.SysEvents.Add(entity);
                db.SaveChanges();

                sys.ID = entity.ID;
            }
        }
Exemple #3
0
        public virtual void Update(SysEventViewModel sys, ModelStateDictionary modelState)
        {
            if (ValidateModel(sys, modelState))
            {
                if (string.IsNullOrEmpty(sys.Message))
                {
                    sys.Message = "";
                }
                var entity = sys.ToEntity();
                db.SysEvents.Attach(entity);

                db.Entry(entity).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
            }
        }