Пример #1
0
        public int UpdateFeature(SystemFeature user)
        {
            var insertUserId = 0;

            try
            {
                var current = _dbContext.SystemFeature.FirstOrDefault(k => k.Id == user.Id);
                if (current != null)
                {
                    current.Name           = user.Name;
                    current.ActionName     = user.ActionName;
                    current.ControllerName = user.ControllerName;
                    _dbContext.SaveChanges();
                    insertUserId = user.Id;
                }
                else
                {
                    insertUserId = 0;
                }
            }
            catch
            {
                return(insertUserId);
            }
            return(insertUserId);
        }
Пример #2
0
        public int AddNewFeature(SystemFeature user)
        {
            var insertUserId = 0;

            try
            {
                _dbContext.SystemFeature.Add(user);
                _dbContext.SaveChanges();
                insertUserId = _dbContext.SystemFeature.Last().Id;
            }
            catch
            {
                return(insertUserId);
            }
            return(insertUserId);
        }