예제 #1
0
        public ActionResult Add()
        {
            IncomeViewModel viewModel = new IncomeViewModel();
            viewModel.Products = Products();

            return View(viewModel);
        }
예제 #2
0
        public static IncomeViewModel From(elfam.web.Models.Income income)
        {
            IncomeViewModel model = new IncomeViewModel();
            model.BuyPrice = income.BuyPrice;
            model.IncomeId = income.Id;
            model.ProductId = income.Product.Id;
            model.Quantity = income.QuantityCurrent;
            return model;

        }
예제 #3
0
        public static IncomeViewModel From(elfam.web.Models.Income income)
        {
            IncomeViewModel model = new IncomeViewModel();

            model.BuyPrice  = income.BuyPrice;
            model.IncomeId  = income.Id;
            model.ProductId = income.Product.Id;
            model.Quantity  = income.QuantityCurrent;
            return(model);
        }
예제 #4
0
 public ActionResult Edit(IncomeViewModel viewModel)
 {
     if (!ModelState.IsValid)
     {
         viewModel.Products = Products();
         return View(viewModel);
     }
     Income income = daoTemplate.FindByID<Income>(viewModel.IncomeId);
     income.BuyPrice = viewModel.BuyPrice;
     income.Product = daoTemplate.FindByID<Product>(viewModel.ProductId);
     income.QuantityCurrent = viewModel.Quantity;
     daoTemplate.Save(income);
     return RedirectToAction("List");
 }
예제 #5
0
 public ActionResult Add(IncomeViewModel viewModel)
 {
     if (!ModelState.IsValid)
     {
         viewModel.Products = Products();
         return View(viewModel);
     }
     Income income = new Income();
     income.Date = DateTime.Now;
     income.BuyPrice = viewModel.BuyPrice;
     income.Product = daoTemplate.FindByID<Product>(viewModel.ProductId);
     income.Category = income.Product.Category;
     income.QuantityCurrent = viewModel.Quantity;
     income.QuantityInital = viewModel.Quantity;
     daoTemplate.Save(income);
     return RedirectToAction("List");
 }