Example #1
0
        public ActionResult GetAdmin(lot change_lot)
        {
            LotRepository lotRep = new LotRepository();
            Expression<Func<lot, bool>> filter = x => x.lotID == change_lot.lotID;
            List<lot> c_lot = lotRep.Get(filter).ToList();
            c_lot[0].statusID = change_lot.statusID;
            lotRep.Save(c_lot[0]);

            filter = x => x.statusID == (int)Status.view;
            List<lot> lots = lotRep.Get(filter).ToList();

            DropDownInit();

            return View(lots);
        }
Example #2
0
        private void LotUpdated(object sender, EventArgs e)
        {
            LotRepository  lotRepository  = new LotRepository(new MyDbContext());
            UserRepository userRepository = new UserRepository(new MyDbContext());

            user = userRepository.Get(user.Name);
            lot  = lotRepository.Get(lot.Id);
            LoadLot();
        }
Example #3
0
        public ActionResult GetAdmin()
        {
            LotRepository lotRep = new LotRepository();
            Expression<Func<lot, bool>> filter = x => x.statusID == (int)Status.view;
            List<lot> lots = lotRep.Get(filter).ToList();

            DropDownInit();

            return View(lots);
        }
Example #4
0
        private void Bid_Button_Click_1(object sender, EventArgs e)
        {
            if (dataGridView_AvailableLots.SelectedRows.Count > 1 && dataGridView_AvailableLots.SelectedRows.Count == 0)
            {
                return;
            }

            int index           = dataGridView_AvailableLots.SelectedRows[0].Index;
            int indexInDataBase = Convert.ToInt32(dataGridView_AvailableLots[0, index].Value.ToString());

            Lot choosedLot = lotRepository.Get(indexInDataBase);

            BidForm bidForm = new BidForm(db, choosedLot, user, this);

            bidForm.Show();
        }
Example #5
0
        private void Edit_Button_Click_1(object sender, EventArgs e)
        {
            if (dataGridView_MyLots.SelectedRows.Count != 1)
            {
                return;
            }

            int index           = dataGridView_MyLots.SelectedRows[0].Index;
            int indexInDataBase = Convert.ToInt32(dataGridView_MyLots[0, index].Value.ToString());

            Lot choosedLot = lotRepository.Get(indexInDataBase);

            EditLotForm editLotForm = new EditLotForm(choosedLot);

            editLotForm.Show();
        }
Example #6
0
        public ViewResult Index(int? current_category, int? current_city, string part_name)
        {
            LotRepository lotRep = new LotRepository();
            Expression<Func<lot, bool>> filter =
                x => (x.cityID == current_city && current_city != null || current_city == null)
                              && (x.categoryID == current_category && current_category != null || current_category == null)
                              && (x.name.IndexOf(part_name.Trim()) != -1 && part_name.Trim() != "" || part_name.Trim() == "")
                              && x.statusID == (int)Status.approve;
            List<lot> lots = lotRep.Get(filter).ToList();

            DropDownInit();

            LotsListViewModel model = new LotsListViewModel
            {
                lots = lots
            };

            return View(model);
        }
Example #7
0
        public ViewResult Index()
        {
            try
            {
                LotRepository lotRep = new LotRepository();
                Expression<Func<lot, bool>> filter = x => x.statusID == (int)Status.approve;
                List<lot> lots = lotRep.Get(filter).ToList();

                DropDownInit();

                LotsListViewModel model = new LotsListViewModel
                     {
                         lots = lots
                     };

                return View(model);
            }
            catch (Exception error)
            {
                return View();
            }
        }