Exemplo n.º 1
0
        public ActionResult Add()
        {
            IncomeViewModel viewModel = new IncomeViewModel();
            viewModel.Products = Products();

            return View(viewModel);
        }
Exemplo n.º 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;

        }
Exemplo n.º 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);
        }
Exemplo n.º 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");
 }
Exemplo n.º 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");
 }