public ActionResult InsertNewSupplier(supplierViewModel _suppViewModel) { try { BrightShoppeDBEntities BSDB = new BrightShoppeDBEntities(); Supplier svm = new Supplier(); svm.SupplierID = _suppViewModel.SupplierID; svm.SuppName = _suppViewModel.SuppName; svm.SuppAddress = _suppViewModel.SuppAddress; svm.SuppCity_Prov = _suppViewModel.SuppCity_Prov; svm.SuppContact_ = _suppViewModel.SuppContact_; svm.SuppEmail = _suppViewModel.SuppEmail; svm.SuppRemarks = _suppViewModel.SuppRemarks; svm.SuppStatus = "ACTIVE"; BSDB.Suppliers.Add(svm); BSDB.SaveChanges(); } catch { } _Logs(Respository._UserName, "3", _suppViewModel.SupplierID); return(Json(_suppViewModel)); }
public ActionResult UpdateSupplier(supplierViewModel _suppViewModel) { try { BrightShoppeDBEntities BSDB = new BrightShoppeDBEntities(); Supplier svm = BSDB.Suppliers.SingleOrDefault(m => m.SupplierID == _suppViewModel.SupplierID); if (svm != null) { svm.SuppName = _suppViewModel.SuppName; svm.SuppAddress = _suppViewModel.SuppAddress; svm.SuppCity_Prov = _suppViewModel.SuppCity_Prov; svm.SuppContact_ = _suppViewModel.SuppContact_; svm.SuppEmail = _suppViewModel.SuppEmail; svm.SuppStatus = "ACTIVE"; BSDB.SaveChanges(); } } catch { throw; } _Logs(Respository._UserName, "4", _suppViewModel.SupplierID); return(Json(_suppViewModel)); }
public ActionResult GetSupplierDetails(string supplierID) { BrightShoppeDBEntities BSDB = new BrightShoppeDBEntities(); Supplier suppDetails = BSDB.Suppliers.Where(x => x.SupplierID == supplierID).Single(); supplierViewModel svm = new supplierViewModel(); if (suppDetails != null) { svm.SuppName = suppDetails.SuppName; svm.SuppAddress = suppDetails.SuppAddress; svm.SuppCity_Prov = suppDetails.SuppCity_Prov; svm.SuppContact_ = suppDetails.SuppContact_; svm.SuppEmail = suppDetails.SuppEmail; } return(Json(svm)); }