Exemplo n.º 1
0
        public ActionResult Add(int?buyerID)
        {
            Models.BuyerVM _model   = null;
            int            _buyerID = 0;

            if (buyerID.HasValue)
            {
                _buyerID = buyerID.Value;
                if (_buyerID > 0)
                {
                    var _bm = _buyerService.GetBuyerDetails(ClientID, _buyerID);
                    if (_bm != null)
                    {
                        _model = Infrastructure.BOVMMapper.Map <BO.BuyerBO, Models.BuyerVM>(_bm);
                    }
                }
            }
            if (_model == null)
            {
                _model          = new Models.BuyerVM();
                _model.BuyerID  = _buyerID;
                _model.ClientID = ClientID;
            }

            _model.BuyerTypeList = Infrastructure.BOVMMapper.Map <List <BO.BuyerTypeBO>, List <Models.BuyerTypeVM> >(_buyerService.GetBuyerTypeList());

            return(View(_model));
        }
Exemplo n.º 2
0
 public ActionResult Add(Models.BuyerVM model)
 {
     try
     {
         model.ClientID = ClientID;
         if (ModelState.IsValid)
         {
             int _buyerID = _buyerService.Add(Infrastructure.BOVMMapper.Map <Models.BuyerVM, BO.BuyerBO>(model));
             if (_buyerID > 0)
             {
                 return(RedirectToAction("Add", new { buyerID = _buyerID }));
             }
         }
     }
     catch (Exception ex)
     {
         base.LogException(ex);
     }
     model.BuyerTypeList = Infrastructure.BOVMMapper.Map <List <BO.BuyerTypeBO>, List <Models.BuyerTypeVM> >(_buyerService.GetBuyerTypeList());
     return(View(model));
 }