예제 #1
0
        public ActionResult AddSupplier(SupplierTypeModel supplier)
        {
            var            supplierServiceClient = new ServiceReference1.SupplierServiceClient();
            SupplierDetail newSupplier           = new SupplierDetail
            {
                CompanyName  = supplier.CompanyName,
                ContactName  = supplier.ContactName,
                ContactTitle = supplier.ContactTitle,
                Country      = supplier.Country,
                Address      = supplier.Address,
                City         = supplier.City,
                Fax          = supplier.Fax,
                Region       = supplier.Region,
                Tel          = supplier.Tel,
                Website      = supplier.Website,
            };

            if (supplierServiceClient.AddSupplier(newSupplier))
            {
                Console.WriteLine("supplier a été ajouté");
                return(View());
            }
            else
            {
                return(View());
            }
        }
예제 #2
0
        public ActionResult Index(String name)
        {
            var suppliername          = name;
            var supplierServiceClient = new ServiceReference1.SupplierServiceClient();

            List <SupplierTypeModel> response = new List <SupplierTypeModel>();

            List <ServiceReference1.SupplierType> listSuppliers = supplierServiceClient.GetSupplierByName(suppliername);

            if (listSuppliers == null)
            {
                Session["SupplierFound"] = 0;
                return(View("Index"));
            }
            else
            {
                foreach (var s in listSuppliers)
                {
                    SupplierTypeModel supplier = new SupplierTypeModel()
                    {
                        CompanyName   = s.CompanyName,
                        SupplierId    = s.SupplierId,
                        ContactName   = s.ContactName,
                        ContactTitle  = s.ContactTitle,
                        Country       = s.Country,
                        ExtensionData = s.ExtensionData
                    };
                    response.Add(supplier);
                }
                Session["SupplierFound"] = 1;
                return(View("Index", response));
            }
        }
예제 #3
0
 public ActionResult Add(SupplierTypeModel model)
 {
     if (ModelState.IsValid)
     {
         SupplierType supplierType = model.MapTo <SupplierTypeModel, SupplierType>();
         _supplierTypeService.Insert(supplierType);
         return(RedirectToAction("Index"));
     }
     return(View(model));
 }
예제 #4
0
 public ActionResult Edit(SupplierTypeModel model)
 {
     if (ModelState.IsValid)
     {
         SupplierType supplierType = model.MapTo <SupplierTypeModel, SupplierType>();
         _supplierTypeService.Update(supplierType);
         SuccessNotification($"{_localizationService.GetResource("UpdateSuccess") }");
         return(RedirectToAction("Index"));
     }
     return(View(model));
 }
예제 #5
0
        /************************************ Show Supplier Details ****************************************
         * ************************************************************************************************************/


        public ActionResult Details(long id)
        {
            var supplierServiceClient = new ServiceReference1.SupplierServiceClient();
            var supplier = supplierServiceClient.GetSupplierDetail(id);

            SupplierTypeModel SupplierById = new SupplierTypeModel
            {
                CompanyName  = supplier.CompanyName,
                ContactName  = supplier.ContactName,
                ContactTitle = supplier.ContactTitle,
                Country      = supplier.Country,
                Address      = supplier.Address,
                City         = supplier.City,
                Fax          = supplier.Fax,
                Region       = supplier.Region,
                Tel          = supplier.Tel,
                Website      = supplier.Website,
            };

            SupplierById.SupplierId = id;

            return(View(SupplierById));
        }
예제 #6
0
        public ActionResult Edit(SupplierTypeModel supplier)
        {
            var            supplierServiceClient = new ServiceReference1.SupplierServiceClient();
            SupplierDetail newSupplier           = new SupplierDetail
            {
                CompanyName  = supplier.CompanyName,
                ContactName  = supplier.ContactName,
                ContactTitle = supplier.ContactTitle,
                Country      = supplier.Country,
                Address      = supplier.Address,
                City         = supplier.City,
                Fax          = supplier.Fax,
                Region       = supplier.Region,
                Tel          = supplier.Tel,
                Website      = supplier.Website,
            };

            newSupplier.SupplierId = (long)Session["SupplierIdModified"];

            supplierServiceClient.UpdateSupplier(newSupplier);
            Session["SupplierIdModified"] = -1;
            return(RedirectToAction("Index"));
        }
예제 #7
0
        /************************************ Adding Supplier ****************************************
         **************************************************************************************************************/
        public ActionResult AddSupplier()
        {
            var supplier = new SupplierTypeModel();

            return(View(supplier));
        }
예제 #8
0
        public ActionResult Add()
        {
            SupplierTypeModel model = new SupplierTypeModel();

            return(View(model));
        }