public ActionResult Create(SaleInfo saleInfo)
 {
     saleInfo.Client = _elementsService.ClientsItems.FirstOrDefault(x => x.Id == saleInfo.Client.Id);
     saleInfo.Product = _elementsService.ProductsItems.FirstOrDefault(x => x.Id == saleInfo.Product.Id);
     var manager = _elementsService.ManagersItems.FirstOrDefault(x => x.Id == saleInfo.FileInfo.Manager.Id);
     saleInfo.FileInfo = new FileInfo
     {
         Manager = manager,
         Date = saleInfo.Date
     };
     _elementsService.Add(saleInfo);
     return RedirectToAction("List");
 }
Пример #2
0
 public void Update(int id, SaleInfo item)
 {
     _saleInfoRepository.Update(id, Mapper.Map<SaleInfo, DAL.Models.SaleInfo>(item));
     _saleInfoRepository.SaveChanges();
 }
Пример #3
0
 public void Add(SaleInfo saleInfo)
 {
     _saleInfoRepository.Add(Mapper.Map<SaleInfo, DAL.Models.SaleInfo>(saleInfo));
     _saleInfoRepository.SaveChanges();
 }