Exemplo n.º 1
0
 private int AddUpdateSupplier()
 {
     if (supplier != null && supplier.Id > 0)
     {
         supplier.Id        = supplier.Id;
         supplier.Name      = txtName.Text;
         supplier.Mobile    = txtMobile.Text;
         supplier.Email     = txtEmail.Text;
         supplier.IsActive  = chkActive.Checked;
         supplier.UpdatedBy = userId;
         return(SupplierDataAccess.UpdateSupplier(supplier));
     }
     else
     {
         var supplierDto = new SupplierDTO()
         {
             Name      = txtName.Text,
             Email     = txtEmail.Text,
             Mobile    = txtMobile.Text,
             IsActive  = chkActive.Checked,
             CreatedBy = userId
         };
         return(SupplierDataAccess.AddSupplier(supplierDto));
     }
 }
Exemplo n.º 2
0
        public ActionResult CreateSupplier(SupplierPO supplierToMap)
        {
            // pass the elements of the supplier to the map through the method call and then to the DAL
            _supplierDataAccess.AddSupplier(_mapper.Map(supplierToMap));

            // return the user to the view supplier page
            return(RedirectToAction("ViewSuppliers"));
        }