public ActionResult AddSaleInfo(SaleInfoModel saleInfo) { List<string> _errList = new List<string>(); bool _success = false; if (ModelState.IsValid) { try { //var tt = Mapper.Map<SaleInfo>(saleInfo); var sin = new SaleInfo(saleInfo.Date, new FileInformation(saleInfo.FileName, saleInfo.Date, new Manager(saleInfo.ManagerName)), new Client(saleInfo.ClientFirstName, saleInfo.ClientSecondName), new Product(saleInfo.ProductName), saleInfo.Cost); new SaleInfoRepository().Add(sin); _success = true; } catch (DalException e) { _errList.Add(e.Message); } catch (Exception x) { _errList.Add("DataBase Error"); } } else { _errList = GetModelErrors(); } return Json(new { success = _success, error = _errList }); }
public ActionResult AddSaleInfo() { var saleInfo = new SaleInfoModel(); return PartialView("AddSaleInfoView", saleInfo); }
public ActionResult DeleteSaleInfoR(int id) { var saleInfo = new SaleInfoModel() { Id = id }; return PartialView("DeleteSaleInfoView", saleInfo); }