예제 #1
0
        public Banknote GetBanknoteById(int id)
        {
            Banknote banknote = new Banknote();

            banknote = database.BanknoteStorage.Where(c => c.Id == id).First();

            return(banknote);
        }
예제 #2
0
        public void DeleteBanknote(int id)
        {
            Banknote banknote = new Banknote();

            banknote = database.BanknoteStorage.Where(c => c.Id == id).First();

            database.BanknoteStorage.Remove(banknote);

            database.SaveChanges();
        }
예제 #3
0
        public int AddBanknote(int value, int count)
        {
            Banknote banknote = new Banknote();

            banknote.Value = value;
            banknote.Count = count;

            database.BanknoteStorage.Add(banknote);

            int resultValue = database.SaveChanges();

            return(resultValue);
        }
예제 #4
0
        public int EditBanknote(int id, int value, int count)
        {
            Banknote banknote = new Banknote();

            banknote = database.BanknoteStorage.Where(c => c.Id == id).First();

            banknote.Value = value;
            banknote.Count = count;

            database.Entry(banknote).State = EntityState.Modified;

            int resultValue = database.SaveChanges();

            return(resultValue);
        }
예제 #5
0
        public List <Banknote> GetAllBanknotes()
        {
            List <Banknote> banknotesList       = new List <Banknote>();
            var             banknotesInDatabase = database.BanknoteStorage;

            foreach (Banknote item in banknotesInDatabase)
            {
                Banknote banknote = new Banknote();

                banknote.Id    = item.Id;
                banknote.Value = item.Value;
                banknote.Count = item.Count;

                banknotesList.Add(banknote);
            }

            return(banknotesList);
        }
예제 #6
0
        public List <Banknote> GetBanknotesByCount(int count)
        {
            List <Banknote> banknotesList = new List <Banknote>();

            IQueryable <Banknote> banknotesInDatabase = database.BanknoteStorage.Where(c => c.Count == count);

            foreach (Banknote item in banknotesInDatabase)
            {
                Banknote banknote = new Banknote();

                banknote.Id    = item.Id;
                banknote.Value = item.Value;
                banknote.Count = item.Count;

                banknotesList.Add(banknote);
            }

            return(banknotesList);
        }