public ActionResult Index() { var lst = taxDal.ReadAllTax(); TaxViewModel taxViewModel = new TaxViewModel(); taxViewModel.lst = new List <TaxViewModel>(); taxViewModel.lst = lst.ConvertAll(x => new TaxViewModel { TaxId = x.TaxId, TaxName = x.TaxName, Value = x.Value }); taxViewModel.IsEdit = false; return(View(taxViewModel)); }
public ActionResult Edit(int id) { CustomerViewModel model = new CustomerViewModel(); Customer cust = new Customer(); cust = customerDAL.ReadCustomerDetailsById(id); model.CustomerId = cust.CustomerId; model.CustomerName = cust.CustomerName; model.CustomerAddress = cust.CustomerAddress; model.CustomerPhone = cust.CustomerPhone; model.TinNumber = cust.TinNumber; model.TaxId = cust.tax.TaxId; model.TaxName = cust.tax.TaxName; var lstTax = taxDAL.ReadAllTax(); model.lstTax = new List <TaxViewModel>(); model.lstTax = lstTax.ConvertAll(x => new TaxViewModel { TaxId = x.TaxId, TaxName = x.TaxName, Value = x.Value }); var lst = customerDAL.ReadAllCustomer(); model.Customers = new List <CustomerViewModel>(); model.Customers = lst.ConvertAll(x => new CustomerViewModel { CustomerId = x.CustomerId, CustomerName = x.CustomerName, CustomerAddress = x.CustomerAddress, CustomerPhone = x.CustomerPhone, TinNumber = x.TinNumber, TaxId = x.tax.TaxId, TaxName = x.tax.TaxName, TaxValue = x.tax.Value }); model.IsEdit = true; return(View("Index", model)); }
private ChallanViewModel GetData() { ChallanViewModel billViewModel = new ChallanViewModel(); var customers = customerDAL.ReadAllCustomer(); billViewModel.Customer.Customers = new List <CustomerViewModel>(); billViewModel.Customer.Customers = customers.ConvertAll(x => new CustomerViewModel { CustomerId = x.CustomerId, CustomerName = x.CustomerName, CustomerAddress = x.CustomerAddress, TaxName = x.tax.TaxName, TaxValue = x.tax.Value }); //Read all categories var lstCategory = categoryDAL.ReadAllCategory(); billViewModel.lstChallanDetails = new List <ChallanDetails>(); billViewModel.lstChallanDetails = lstCategory.ConvertAll(x => new ChallanDetails { CategoryId = x.CategoryId, CategoryName = x.CategoryName, Rate = x.Rate, Discount = x.Discount }); var taxes = taxDAL.ReadAllTax(); billViewModel.ecess = taxes.Where(x => x.TaxId == (int)TaxType.ECESS).FirstOrDefault().Value; billViewModel.shecess = taxes.Where(x => x.TaxId == (int)TaxType.SHECESS).FirstOrDefault().Value; billViewModel.freight = taxes.Where(x => x.TaxId == (int)TaxType.Freight).FirstOrDefault().Value; billViewModel.tcs = taxes.Where(x => x.TaxId == (int)TaxType.TCS).FirstOrDefault().Value; return(billViewModel); }