public DealSortByPopup()
        {
            InitializeComponent();
            vm = new DealViewModel();
            this.BindingContext = vm;

            if (Device.RuntimePlatform == Device.Android)
            {
                SortPopupStackVw.Padding = new Thickness(15, 120, 15, 120);
            }
            else if (Device.RuntimePlatform == Device.iOS)
            {
                var mainDisplayInfo = DeviceDisplay.MainDisplayInfo;
                if (mainDisplayInfo.Height <= 1334)
                {
                    // iPhone 6, 7, 8
                    SortPopupStackVw.Padding = new Thickness(15, 140, 15, 140);
                }
                else
                {
                    //iPhone X, XS, XR, 11
                    SortPopupStackVw.Padding = new Thickness(15, 200, 15, 200);
                }
            }
        }
Ejemplo n.º 2
0
        public ActionResult Create(int id, int?FilterDealIdentifierId, string FilterDealIdentifierText, int?FilterBusOperatorId, int?FilterBusCategoryId, int?FilterCurrencyId)
        {
            DealViewModel viewmodel = new DealViewModel();

            viewmodel.DealMasterList      = mDealProvider.GetAllDealMasterList(1);
            viewmodel.DealAppliedOnList   = mDealProvider.GetAllDealAppliedOnList();
            viewmodel.DealCalculateOnList = mDealProvider.GetAllDealCalculateOnList();
            viewmodel.DealMasterId        = id;
            viewmodel.DealMaserText       = mDealProvider.GetDealMasterById(id).DealName;
            viewmodel.DealIdentifierId    = FilterDealIdentifierId != null ? FilterDealIdentifierId.Value : 0;
            viewmodel.DealIdentifierText  = FilterDealIdentifierText;
            viewmodel.BusOperatorId       = FilterBusOperatorId != null ? FilterBusOperatorId.Value : 0;
            viewmodel.BusCategoryId       = FilterBusCategoryId != null?FilterBusCategoryId.Value :0;
            viewmodel.CurrencyId          = FilterCurrencyId != null ? FilterCurrencyId.Value : 0;

            viewmodel.BusOperatorList = mbDealProvider.GetAllBusOperatorList();
            viewmodel.BusCategoryList = mbDealProvider.GetAllBusCategoryList(FilterBusOperatorId ?? 0);


            viewmodel.CurrencyList       = mDealProvider.GetCurrencyList().Where(x => x.Value == "1");
            viewmodel.DealIdentifierList = mDealProvider.GetBusDealIdentifiers(mDealProvider.GetDealMasterById(id).DealTypeId);

            if (Request != null && Request.IsAjaxRequest())
            {
                return(PartialView("CreateDeal", viewmodel));
            }
            else
            {
                return(View(viewmodel));
            }
        }
Ejemplo n.º 3
0
        public ActionResult Index(DealViewModel model)
        {
            TravelSession obj = (TravelSession)Session["TravelPortalSessionInfo"];

            model.MakerId    = obj.AppUserId;
            model.MakerDate  = DateTime.Now;
            model.isVerified = false;
            model.isDelete   = false;

            mDealProvider.Update_Mobile_Deals(model);
            DealViewModel viewmodel = new DealViewModel()
            {
                DealMasterList      = mDealProvider.GetAllDealMasterList(3),
                DealAppliedOnList   = mDealProvider.GetAllDealAppliedOnList(),
                DealCalculateOnList = mDealProvider.GetAllDealCalculateOnList(),
                DealIdentifierList  = mDealProvider.GetMobileDealIdentifiers(mDealProvider.GetDealMasterById(model.DealMasterId).DealTypeId),
                DealList            = mDealProvider.GetAllMobileDeals(model.DealMasterId, null)
            };

            if (Request != null && Request.IsAjaxRequest())
            {
                return(PartialView("DisplayDealTemplate", viewmodel));
            }
            else
            {
                return(View(viewmodel));
            }
        }
Ejemplo n.º 4
0
        ///////////////////////////Deal Setup Action Starts Here/////////////////////////////
        public ActionResult AjaxDealDetail(int id, string source)
        {
            ATLTravelPortal.Areas.Airline.Repository.MasterDealProvider masDealProvider = new ATLTravelPortal.Areas.Airline.Repository.MasterDealProvider();
            BranchDealProvider mbDealProvider = new BranchDealProvider();

            DealViewModel viewModel = new DealViewModel();

            viewModel = masDealProvider.GetBusDealDetail(id);

            viewModel.DealMasterList      = masDealProvider.GetAllDealMasterList(4);
            viewModel.DealAppliedOnList   = masDealProvider.GetAllDealAppliedOnList();
            viewModel.DealCalculateOnList = masDealProvider.GetAllDealCalculateOnList();

            viewModel.BusOperatorList = mbDealProvider.GetAllBusOperatorList();
            viewModel.BusCategoryList = mbDealProvider.GetAllBusCategoryList(viewModel.BusOperatorId ?? 0);

            viewModel.CurrencyList       = masDealProvider.GetCurrencyList().Where(x => x.Value == "1");
            viewModel.DealIdentifierList = masDealProvider.GetBusDealIdentifiers(masDealProvider.GetDealMasterById(viewModel.DealMasterId).DealTypeId);


            if (Request != null && Request.IsAjaxRequest())
            {
                return(PartialView("VUC_DealEdit", viewModel));
            }
            else
            {
                return(View(viewModel));
            }
        }
Ejemplo n.º 5
0
        public HttpResponseMessage SendDeal(HttpRequestMessage request, DealViewModel dealViewModel)
        {
            try
            {
                var user = _membershipService.GetUserByEmail(dealViewModel.Email);
                if (dealViewModel.IsPurchase)
                {
                    _dealService.AddPurchaseDeal(DealFromViewModel(user, dealViewModel));
                }
                else
                {
                    _dealService.AddSaleDeal(DealFromViewModel(user, dealViewModel));
                }

                _appHub.Clients.All.addActivity(AddRecentActivity(dealViewModel));
                return(ReturnResponseForDeal(request, dealViewModel));
            }
            catch (Exception e)
            {
                _logger.Error(e);

                return(request.CreateResponse(HttpStatusCode.OK,
                                              new { success = false, message = Messages.CantExecuteDeal }));
            }
        }
Ejemplo n.º 6
0
 public ActionResult EditDeal(DealViewModel deal)
 {
     try
     {
         var userId = Convert.ToInt32(Session[KeyList.SessionKeys.UserID].ToString());
         if (ModelState.IsValid)
         {
             var  strikePrice = deal.Price - (decimal)((double)deal.Discount / 100 * deal.Price);
             Deal _deal       = dealServices.GetByID(deal.DealId);
             _deal.Title       = deal.Title;
             _deal.Price       = deal.Price;
             _deal.Discount    = deal.Discount;
             _deal.ValidTill   = deal.ValidTill;
             _deal.Description = deal.Description;
             _deal.StrikePrice = strikePrice;
             dealServices.UpdateDeal(_deal);
             Logs GenerateLog = new Logs();
             GenerateLog.CreateLog(userId, KeyList.LogMessages.EditStore);
         }
         return(RedirectToAction("Deal"));
     }
     catch (Exception)
     {
         return(View(deal));
     }
 }
Ejemplo n.º 7
0
        protected override void OnAppearing()
        {
            base.OnAppearing();

            App.ReadUnread    = "null";
            App.OrderByText   = Constants.LastPostDateText;
            App.SelectedTitle = string.Empty;
            App.SelectedName  = string.Empty;
            App.FollowUp      = "null";
            vm = new DealViewModel();
            this.BindingContext = vm;

            if (NetworkCheck.IsInternet())
            {
                _ = vm.FetchDealData();
            }
            else
            {
                DisplayAlert("Simon", "No network is available.", "OK");
            }

            if (Application.Current.Properties.ContainsKey("USERID"))
            {
                userId = Convert.ToString(Application.Current.Properties["USERID"]);
            }
        }
Ejemplo n.º 8
0
        public ActionResult Index(HttpPostedFileBase flDealerDetails)
        {
            var dealViewModel = new DealViewModel();

            try
            {
                //check if the model state is valid
                if (ModelState.IsValid)
                {
                    var csvReader         = new StreamReader(flDealerDetails.InputStream, Encoding.Default, true);
                    var lstDealDetails    = ApplicationService.DealDetailsRepository.GetDealDataFromCsv(csvReader);
                    var dealGridViewModel = new DealGridViewModel()
                    {
                        DealDetails = lstDealDetails
                    };

                    dealViewModel.DealGrid =
                        RenderPartialViewToString("~/Views/ImportCsv/DealGrid.cshtml", dealGridViewModel);
                }
            }
            catch (Exception ex)
            {
                return(View("Error", new HandleErrorInfo(ex, "ImportCSV", "Index")));
            }
            finally
            {
                GC.Collect();
            }

            return(View(dealViewModel));
        }
Ejemplo n.º 9
0
        public ActionResult Index(int?id, string FilterDealIdentifierId, int?FilterBusOperatorId, int?FilterBusCategoryId, int?FilterCurrencyId)
        {
            var           dealtype  = mDealProvider.GetDealMasterById(id ?? 0);
            DealViewModel viewmodel = new DealViewModel();

            viewmodel.DealMasterList      = mDealProvider.GetAllDealMasterList(4);
            viewmodel.DealAppliedOnList   = mDealProvider.GetAllDealAppliedOnList();
            viewmodel.DealCalculateOnList = mDealProvider.GetAllDealCalculateOnList();

            viewmodel.BusOperatorList = mbDealProvider.GetAllBusOperatorList();
            viewmodel.BusCategoryList = mbDealProvider.GetAllBusCategoryList(FilterBusOperatorId ?? 0);

            viewmodel.CurrencyList       = mDealProvider.GetCurrencyList().Where(x => x.Value == "1");
            viewmodel.DealIdentifierList = mDealProvider.GetBusDealIdentifiers(dealtype != null ? dealtype.DealTypeId : 0);
            viewmodel.DealList           = mDealProvider.GetAllBusDeals(id, FilterDealIdentifierId, FilterBusOperatorId, FilterBusCategoryId, FilterCurrencyId);

            if (Request != null && Request.IsAjaxRequest())
            {
                return(PartialView("VUC_DealDetailList", viewmodel));
            }
            else
            {
                return(View(viewmodel));
            }
        }
Ejemplo n.º 10
0
        public ActionResult Index(DealViewModel model)
        {
            TravelSession obj = (TravelSession)Session["TravelPortalSessionInfo"];

            model.MakerId    = obj.AppUserId;
            model.MakerDate  = DateTime.Now;
            model.isVerified = false;
            model.isDelete   = false;

            mDealProvider.Update_Tkt_Deals(model);
            DealViewModel viewmodel = new DealViewModel()
            {
                CurrencyList        = mDealProvider.GetCurrencyList().Where(x => x.Value == "1"),
                DealMasterList      = mDealProvider.GetAllDealMasterList(4),
                DealAppliedOnList   = mDealProvider.GetAllDealAppliedOnList(),
                DealCalculateOnList = mDealProvider.GetAllDealCalculateOnList(),
                BusOperatorList     = mbDealProvider.GetAllBusOperatorList(),
                BusCategoryList     = mbDealProvider.GetAllBusCategoryList(model.BusOperatorId ?? 0),
                DealIdentifierList  = mDealProvider.GetBusDealIdentifiers(mDealProvider.GetDealMasterById(model.DealMasterId).DealTypeId),
                DealList            = mDealProvider.GetAllBusDeals(model.DealMasterId, null, null, null, null)
            };

            if (Request != null && Request.IsAjaxRequest())
            {
                return(PartialView("DisplayDealTemplate", viewmodel));
            }
            else
            {
                return(View(viewmodel));
            }
        }
Ejemplo n.º 11
0
        public IHttpActionResult Post(DealViewModel dealVm)
        {
            Deal deal = Mapper.Map <DealViewModel, Deal>(dealVm);

            this._dealRepository.Add(deal);
            return(Ok("a deal is added"));
        }
Ejemplo n.º 12
0
        // GET: Deal/Create
        public ActionResult CreateDeal()
        {
            var           userId   = Convert.ToInt32(Session[KeyList.SessionKeys.UserID].ToString());
            DealViewModel dropdown = DropDownForstore(userId);

            return(View(dropdown));
        }
Ejemplo n.º 13
0
        public async Task <IActionResult> Create()
        {
            DealViewModel viewModel = new DealViewModel()
            {
                Contacts = await _ploomesApiRepo.FindAllContactsAsync()
            };

            return(View(viewModel));
        }
Ejemplo n.º 14
0
        public async Task <IActionResult> Details(int id)
        {
            DealViewModel viewModel = new DealViewModel()
            {
                Deal      = await _ploomesApiRepo.FindDealByIdAsync(id),
                DealTasks = await _ploomesApiRepo.FindAllDealTasksAsync(id)
            };

            return(View(viewModel));
        }
Ejemplo n.º 15
0
 public DealView()
 {
     SizeChanged += OnSizeChanged;
     VM           = new DealViewModel(this);
     DataContext  = VM;
     InitializeComponent();
     DealDetail.Owner = this;
     VM.InitAsync();
     Init(null);
 }
Ejemplo n.º 16
0
 private Deal DealFromViewModel(User user, DealViewModel dealViewModel)
 {
     return(new Deal
     {
         UserId = user.Id,
         User = user,
         ResourceId = dealViewModel.ResourceId,
         Amount = dealViewModel.Price * dealViewModel.Quantity,
         Quantity = dealViewModel.Quantity
     });
 }
Ejemplo n.º 17
0
        private DealViewModel DropDownForstore(int userId)
        {
            DealViewModel dropdown = new DealViewModel();

            dropdown.StoreList = storeService.Get(x => x.UserProfile.UserId == userId).
                                 Select(p => new StoreViewModel {
                StoreId = p.StoreId, StoreName = p.StoreName
            }).
                                 ToList();
            return(dropdown);
        }
Ejemplo n.º 18
0
        public ActionResult Index(int?id, string FilterDealIdentifierId, int?FilterAirlineId, int?FilterCurrencyId, string Source)
        {
            var           dealtype  = mDealProvider.GetDealMasterById(id ?? 0);
            DealViewModel viewmodel = new DealViewModel();

            viewmodel.AirlineNameList     = mDealProvider.GetAllAirlineNameList();
            viewmodel.DealMasterList      = mDealProvider.GetAllDealMasterList(1);
            viewmodel.DealAppliedOnList   = mDealProvider.GetAllDealAppliedOnList();
            viewmodel.DealCalculateOnList = mDealProvider.GetAllDealCalculateOnList();

            if (Source == "5")
            {
                viewmodel.Source       = 5;
                viewmodel.CurrencyList = mDealProvider.GetCurrencyList().Where(x => x.Text == "INR");
                IEnumerable <SelectListItem> dealIdentifierList = mDealProvider.GetDealIdentifiers(dealtype != null ? dealtype.DealTypeId : 0);
                if (dealIdentifierList.Count() > 0)
                {
                    dealIdentifierList = dealIdentifierList.Where(z => z.Value == "5");
                }
                viewmodel.DealIdentifierList = dealIdentifierList;
                FilterDealIdentifierId       = "A-TBOAIR-DEAL";
                viewmodel.DealList           = mDealProvider.GetAllDeals(id, FilterDealIdentifierId, FilterAirlineId, FilterCurrencyId);
            }
            else
            {
                viewmodel.CurrencyList       = mDealProvider.GetCurrencyList();
                viewmodel.DealIdentifierList = mDealProvider.GetDealIdentifiers(dealtype != null ? dealtype.DealTypeId : 0);
                viewmodel.DealList           = mDealProvider.GetAllDeals(id, FilterDealIdentifierId, FilterAirlineId, FilterCurrencyId);
            }

            //DealViewModel viewmodel = new DealViewModel()
            //{
            //    AirlineNameList = mDealProvider.GetAllAirlineNameList(),
            //    CurrencyList = mDealProvider.GetCurrencyList(),
            //    DealMasterList = mDealProvider.GetAllDealMasterList(1),
            //    DealAppliedOnList = mDealProvider.GetAllDealAppliedOnList(),
            //    DealCalculateOnList = mDealProvider.GetAllDealCalculateOnList(),
            //    DealIdentifierList = mDealProvider.GetDealIdentifiers(dealtype != null ? dealtype.DealTypeId : 0),
            //    DealList = mDealProvider.GetAllDeals(id, FilterDealIdentifierId, FilterAirlineId, FilterCurrencyId),
            //};

            if (Request != null && Request.IsAjaxRequest())
            {
                return(PartialView("VUC_DealDetailList", viewmodel));
            }
            else
            {
                return(View(viewmodel));
            }
        }
Ejemplo n.º 19
0
        ///////////////Deal Items///////////////
        ////////////////////////////////////////

        public DealViewModel getAllDealViewModels(string id)
        {
            var deals = _repo.Query <Deal>().Where(c => c.UserId == id).ToList();

            var companies = _repo.Query <Company>().ToList();

            var contacts = _repo.Query <Contact>().ToList();

            var dealViewModel = new DealViewModel
            {
                DealList = deals
            };

            return(dealViewModel);
        }
Ejemplo n.º 20
0
        public DealViewModel getDealViewModel(int id)
        {
            var deals = _repo.Query <Deal>().Where(d => d.Id == id).FirstOrDefault();

            var companies = _repo.Query <Company>().ToList();

            var contacts = _repo.Query <Contact>().ToList();

            var dealViewModel = new DealViewModel
            {
                Deal = deals
            };

            return(dealViewModel);
        }
Ejemplo n.º 21
0
        public DealViewModel getAllDealsSharedByContactEmail(string email)
        {
            var dealContacts = _repo.Query <DealContact>().Where(c => c.ContactEmail == email && c.isDealSharer == true).ToList();

            var deals = _repo.Query <Deal>().ToList();

            var contacts = _repo.Query <Contact>().ToList();

            var dealViewModel = new DealViewModel
            {
                DealContactsList = dealContacts
            };

            return(dealViewModel);
        }
Ejemplo n.º 22
0
        public async Task <IActionResult> Create(Deal deal)
        {
            if (!ModelState.IsValid)
            {
                DealViewModel viewModel = new DealViewModel()
                {
                    Contacts = await _ploomesApiRepo.FindAllContactsAsync()
                };
                return(View(viewModel));
            }

            await _ploomesApiRepo.CreateDealAsync(deal);

            return(RedirectToAction("Details", "Contacts", new { Id = deal.ContactId }));
        }
Ejemplo n.º 23
0
        public DealViewModel getAllDealContactsByDealId(int id)
        {
            var dealContacts = _repo.Query <DealContact>().Where(dc => dc.DealId == id && dc.isDealSharer == false).ToList();

            var deals = _repo.Query <Deal>().ToList();

            var contacts = _repo.Query <Contact>().ToList();

            var dealViewModel = new DealViewModel
            {
                DealContactsList = dealContacts
            };

            return(dealViewModel);
        }
Ejemplo n.º 24
0
 public DealsController(ApplicationDbContext context)
 {
     _context      = context;
     DealViewModel = new DealViewModel()
     {
         Deal      = new Deal(),
         Employees = _context.Employees.ToList(),
         Products  = _context.Products.ToList(),
         Projects  = _context.Projects.ToList()
     };
     DealViewModel.EmployeesNames = DealViewModel.Employees.Select(c => new FullName()
     {
         Id = c.Id, Name = c.FirstName + " " + c.LastName
     });
 }
Ejemplo n.º 25
0
        public ActionResult AjaxDealCancel(int id)
        {
            DealViewModel viewModel = new DealViewModel();

            viewModel = mDealProvider.GetDealDetail(id);

            if (Request != null && Request.IsAjaxRequest())
            {
                return(PartialView("VUC_DealDetail", viewModel));
            }
            else
            {
                return(View(viewModel));
            }
        }
Ejemplo n.º 26
0
        public ActionResult EditDeal(int id)
        {
            Deal          deal     = dealServices.GetByID(id);
            var           Images   = deal.DealImages;
            DealViewModel dropdown = new DealViewModel
            {
                DealId      = deal.DealId,
                Title       = deal.Title,
                Price       = Convert.ToInt32(deal.Price),
                Discount    = Convert.ToInt32(deal.Discount),
                ValidTill   = DateTime.Parse(deal.ValidTill.ToString()),
                Description = deal.Description,
            };

            return(View(dropdown));
        }
Ejemplo n.º 27
0
        public ActionResult AjaxDealCancel(int id)
        {
            ATLTravelPortal.Areas.Airline.Repository.MasterDealProvider masDealProvider = new ATLTravelPortal.Areas.Airline.Repository.MasterDealProvider();
            DealViewModel viewModel = new DealViewModel();

            viewModel = masDealProvider.GetBusDealDetail(id);

            if (Request != null && Request.IsAjaxRequest())
            {
                return(PartialView("VUC_DealDetail", viewModel));
            }
            else
            {
                return(View(viewModel));
            }
        }
Ejemplo n.º 28
0
        public DealViewModel getDealLogItemViewModelByDealId(int id)
        {
            var dealLogItems = _repo.Query <DealLogItem>().Where(dli => dli.DealId == id).ToList();

            var deals = _repo.Query <Deal>().ToList();

            var companies = _repo.Query <Company>().ToList();

            var contacts = _repo.Query <Contact>().ToList();

            var dealViewModel = new DealViewModel
            {
                DealLogItemsList = dealLogItems
            };

            return(dealViewModel);
        }
Ejemplo n.º 29
0
        ///////////////DealLogItems///////////////
        //////////////////////////////////////////

        public DealViewModel getAllDealLogItemsViewModels()
        {
            var dealLogItems = _repo.Query <DealLogItem>().ToList();

            var deals = _repo.Query <Deal>().ToList();

            var companies = _repo.Query <Company>().ToList();

            var contacts = _repo.Query <Contact>().ToList();

            var dealViewModel = new DealViewModel
            {
                DealLogItemsList = dealLogItems
            };

            return(dealViewModel);
        }
Ejemplo n.º 30
0
        public ActionResult Create(DealViewModel viewModel)
        {
            if (viewModel != null && this.ModelState.IsValid)
            {
                Deal deal = new Deal()
                {
                    Name = this.sanitizer.Sanitize(viewModel.Name),
                    ClientId = this.User.Identity.GetUserId(),
                    Value = viewModel.Value
                };

                this.deals.Create(deal);
                this.deals.SaveChanges();
            }

            return this.RedirectToAction("Index", "Home", new { area = "Deals" });
        }
Ejemplo n.º 31
0
        public IHttpActionResult GetDealById(string dealId = null)
        {
            if (dealId == null)
            {
                BadRequest("dealId is null");
            }
            Guid guidDealId;

            Guid.TryParse(dealId, out guidDealId);
            if (guidDealId == Guid.Empty)
            {
                BadRequest("guidDealId is not valid");
            }
            Deal          deal   = this._dealRepository.GetById(guidDealId);
            DealViewModel dealVm = Mapper.Map <Deal, DealViewModel>(deal);

            return(Ok(dealVm));
        }
Ejemplo n.º 32
0
 public ActionResult Buy(DealViewModel deal)
 {
     return RedirectToAction("Chekout", deal);
 }
Ejemplo n.º 33
0
 //
 // GET: /Deal/
 public ActionResult Index()
 {
     DealViewModel DealVM = new DealViewModel();
     return View(DealVM);
 }
Ejemplo n.º 34
0
 public ActionResult Chekout(DealViewModel viewModel)
 {
     if (ModelState.IsValid) {
         using (var ctx= new BakeryDbContext()) {
             var order = Mapper.Map<DealViewModel, Order>(viewModel);
             order.User = HttpContext.User.Identity.Name;
             ctx.Orders.AddOrUpdate(order);
             ctx.SaveChanges();
         }
     }
     return RedirectToAction("Index");
 }
Ejemplo n.º 35
0
        // GET: Deals/Edit/5
        public ActionResult Edit(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            Deal deal = db.Deals.Find(id);
            if (deal == null)
            {
                return HttpNotFound();
            }
            var editDeal = new DealViewModel();
            editDeal.Amount = deal.Amount;
            editDeal.BankAcctId = (int)deal.BankAcctId;
            editDeal.CategoryId = (int)deal.CategoryId;
            TempData["oldCategoryId"] = deal.CategoryId ?? default(int);
            editDeal.DealDate = deal.DealDate.Date;
            editDeal.Description = deal.Description;
            editDeal.Id = deal.Id;

            editDeal.Payee = deal.Payee;
            editDeal.Reconciled = deal.Reconciled;

            //var user = db.Users.Find(User.Identity.GetUserId());
            //var Household = db.Households.Find(user.HouseholdId);
            int? HhId = Convert.ToInt32(User.Identity.GetHouseholdId());
            var Household = db.Households.Find(HhId);
            ViewBag.BankAcctId = new SelectList(Household.BankAccts.OrderBy(b => b.AccountName).ToList(), "Id", "AccountName");
            if (deal.Category.IsExpense)
            {
                ViewBag.CategoryId = new SelectList(Household.Categories.Where(
                    c => c.IsExpense == true).OrderBy(c => c.Name).ToList(), "Id", "Name");
                editDeal.IsExpense = true;
            }
            else {
                ViewBag.CategoryId = new SelectList(Household.Categories.Where(
                    c => c.IsExpense == false).OrderBy(c => c.Name).ToList(), "Id", "Name");
                editDeal.IsExpense = false;
            }
            return View(editDeal);
        }
Ejemplo n.º 36
0
        // GET: Deals/New
        public ActionResult New()
        {
            var newDeal = new DealViewModel();
            newDeal.DealDate = System.DateTimeOffset.Now;

            var user = db.Users.Find(User.Identity.GetUserId());

            ViewBag.BankAcctId = new SelectList(db.BankAccts.Where(
                b => b.HouseholdId == user.HouseholdId).OrderBy(b => b.AccountName), "Id", "AccountName");

            ViewBag.ExpenseId = new SelectList(db.Categories.Where(
                c => c.IsExpense == true && c.HouseholdId == user.HouseholdId).OrderBy(c => c.Name), "Id", "Name");

            ViewBag.IncomeId = new SelectList(db.Categories.Where(
                c => c.IsExpense == false && c.HouseholdId == user.HouseholdId).OrderBy(c => c.Name), "Id", "Name");

            return View(newDeal);
        }