Esempio n. 1
0
        public void AddRunInfo(string prjName, int cnt)
        {
            var runInfo = new RunInfoTable(prjName, DateTime.Now, cnt);

            AllRunInfos.Add(runInfo);
            SelectedRunInfo = runInfo;
            string errMsg = "";

            databseHelper.Add(runInfo, ref errMsg);
        }
Esempio n. 2
0
        public void Add_WhenCalled_AddAccount()
        {
            var account = new Account {
                DateTime = this.dateTime, Name = "account"
            };

            var databaseHelper = new DatabaseHelper(this.context);

            databaseHelper.Add(account);
            this.context.SaveChanges();
            var accounts = this.context.Accounts;

            Assert.That(accounts.Count, Is.EqualTo(1));
            Assert.That(accounts.First().Id, Is.Not.Zero);
            Assert.That(accounts.First().DateTime, Is.EqualTo(account.DateTime));
            Assert.That(accounts.First().Name, Is.EqualTo(account.Name));
        }
Esempio n. 3
0
        public List <Suggestion> Post([FromBody] Preference preference)
        {
            var preferences = DatabaseHelper.Get(Key);

            string error;

            if (!SuggestionHelper.IsValidPreference(preferences, preference, out error))
            {
                RequestHelper.Respons("InvalidInput", error, 400);
            }

            preference.Id = DatabaseHelper.NextId(Key);

            DatabaseHelper.Add(Key, preference);

            return(SuggestionHelper.GetSuggestions(DatabaseHelper.Get(Key)));
        }
Esempio n. 4
0
 public IActionResult Add([Bind("MaPhieu,TenDG,TenSach,TenChiNhanh,SoLuongMuon,NgayMuon")] MuonSachView pms)
 {
     if (ModelState.IsValid && pms.MaPhieu != null)
     {
         PhieuMuonSachSV res = new PhieuMuonSachSV
         {
             MaPhieu     = pms.MaPhieu,
             DocGia      = pms.TenDG,
             Sach        = pms.TenSach,
             ChiNhanh    = pms.TenChiNhanh,
             SoLuongMuon = pms.SoLuongMuon,
             NgayMuon    = pms.NgayMuon
         };
         DatabaseHelper.Add(res);
         pms.Id = res.Id;
         RedirectToAction(nameof(Index));
     }
     return(View(pms));
 }
Esempio n. 5
0
        public async Task <IActionResult> Items(string name)
        {
            DatabaseHelper.Reset();
            if (String.IsNullOrEmpty(name))
            {
                _pageHelper.Dispose(null);
                this.BindToView(_pageHelper);
                return(View());
            }

            var query = await DatabaseHelper.Add(name);

            _pageHelper.Startup <DataModel>(query, contains: name);

            List <DataModel> items = DatabaseHelper.SelectByPage(_pageHelper);

            this.BindToView(_pageHelper);

            return(View(items));
        }