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()); } }
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)); } }
public ActionResult Add(SupplierTypeModel model) { if (ModelState.IsValid) { SupplierType supplierType = model.MapTo <SupplierTypeModel, SupplierType>(); _supplierTypeService.Insert(supplierType); return(RedirectToAction("Index")); } return(View(model)); }
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)); }
/************************************ 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)); }
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")); }
/************************************ Adding Supplier **************************************** **************************************************************************************************************/ public ActionResult AddSupplier() { var supplier = new SupplierTypeModel(); return(View(supplier)); }
public ActionResult Add() { SupplierTypeModel model = new SupplierTypeModel(); return(View(model)); }