示例#1
0
 internal void RemoveMethods(T method)
 {
     using (MethodStoreContext context = new MethodStoreContext())
     {
         context.Remove(method);
         context.SaveChanges();
     }
 }
示例#2
0
        internal void Update(T obj)
        {
            using (MethodStoreContext context = new MethodStoreContext())
            {
                if (obj is Models.Method objMethod)
                {
                    if (objMethod.ID == 0)
                    {
                        context.Add(objMethod);
                    }
                    else
                    {
                        context.Update(objMethod);
                    }
                }
                else if (obj is Models.Group objGroup)
                {
                    if (objGroup.ID == 0)
                    {
                        context.Add(objGroup);
                    }
                    else
                    {
                        context.Update(objGroup);
                    }
                }
                else if (obj is Models.Types objTypes)
                {
                    if (objTypes.ID == 0)
                    {
                        context.Add(objTypes);
                    }
                    else
                    {
                        context.Update(objTypes);
                    }
                }

                context.SaveChanges();
            }
        }