示例#1
0
        public List <MenuViewModel> GetAllMenus()
        {
            List <MenuViewModel> data = null;
            var  canGetAllMenuValue   = configurationProvider.GetAppSetting("CanGetAllMenus");
            bool canGetAllMenu;

            if (bool.TryParse(canGetAllMenuValue, out canGetAllMenu))
            {
                data = menuRepository
                       .GetAll()
                       .Select(s => new MenuViewModel
                {
                    Id          = s.Id,
                    Name        = s.Name,
                    Description = s.Description
                }).ToList();
            }
            return(data);
        }
        public void Initialize()
        {
            string dbFilePath = configurationProvider.GetAppSetting("SQLiteTestMultipleDbFilePath");

            if (!File.Exists(dbFilePath))
            {
                SQLiteConnection.CreateFile(dbFilePath);
                const string sql = @"CREATE TABLE [Promotions](
                                        [Id][text] NOT NULL,
                                        [Name] [nvarchar](250) NULL,
                                        [CategoryName] [nvarchar](250) NULL);

                                        CREATE TABLE [Users](
                                            [Id] [text] NOT NULL,
                                            [Username] [nvarchar](250) NULL,
                                            [Password] [nvarchar](250) NULL,
                                            [Email] [nvarchar](250) NULL);";

                dataCommandExecuter.Execute(sql);
            }
        }
 public static string GetAppSetting(string key)
 {
     return(_provider.GetAppSetting(key));
 }