public ActionResult Login(LoginViewModel model) { if (ModelState.IsValid) { BusinessLayerManager <EvernoteUser> res = evernoteUserManager.LoginUser(model); if (res.Errors.Count > 0) { if (res.Errors.Find(x => x.Code == ErrorMessageCode.UserIsNotActive) != null) { ViewBag.SetLink = "http://Home/Activate/123-456-789"; } res.Errors.ForEach(x => ModelState.AddModelError("", x.Message)); return(View(model)); } Session["Login"] = res.Result; return(RedirectToAction("Index")); } return(View()); }
public ActionResult EditProfile(EvernoteUser model, HttpPostedFileBase ProfileImage) { ModelState.Remove("ModifiedUsername"); if (ModelState.IsValid) { if (ProfileImage != null && (ProfileImage.ContentType == "image/jpg" || ProfileImage.ContentType == "image/jpeg" || ProfileImage.ContentType == "image/png")) { string filename = $"user_{model.Id}.{ProfileImage.ContentType.Split('/')[1]}"; ProfileImage.SaveAs(Server.MapPath($"~/Images/{filename}")); model.ProfileImageFileName = filename; } BusinessLayerManager <EvernoteUser> res = evernoteUserManager.UpdateProfile(model); if (res.Errors.Count > 0) { ErrorViewModel message = new ErrorViewModel() { Items = res.Errors, Title = "Profile Güncellenemedi.", RedicrtingUrl = "/Home/EditProfile", RedirectingTimeout = 5000 }; return(View("Error", message)); } Session["Login"] = res.Result; return(RedirectToAction("ShowProfile")); } return(View(model)); }
public ActionResult HandleForm(AddProduitViewModel p) { BusinessLayerManager blm = BusinessLayerManager.Instance; blm.AjouterProduit(p.produit); return(RedirectToAction("Index", "Home")); }
public ActionResult DetailCommande(int id) { BusinessLayerManager blm = BusinessLayerManager.Instance; Commande c = blm.GetAllCommande().Find(commande => commande.Id == id); return(View(c)); }
public ActionResult Detail(int id) { BusinessLayerManager blm = BusinessLayerManager.Instance; Produit p = blm.GetProduit(id); return(View(p)); }
public ActionResult Edit(int id) { BusinessLayerManager blm = BusinessLayerManager.Instance; Produit pToEdit = blm.GetProduit(id); AddProduitViewModel addproduitViewModel = new AddProduitViewModel(pToEdit); return(View("../Edit/Edit", addproduitViewModel)); }
public void GetAllImagesFromDB() { BusinessLayerManager BLM = new BusinessLayerManager(); List <Tour> tourlist = BLM.GetAllToursFromDB(); TourSqlPostgresDAO tourdao = new TourSqlPostgresDAO(PostgresSqlConnector.Instance()); List <string> imageList = (List <string>)tourdao.GetAllTourImages(); Assert.AreEqual(tourlist.Count, imageList.Count); }
public void SearchTest_BLM() { BusinessLayerManager BLM = new BusinessLayerManager(); BLM.CreateNewTour("SEARCHTEST1", "Stephansplatz,Vienna,Austria", "Mariahilfer-Straße,Vienna,Austria", ""); List <Tour> searchList = (List <Tour>)BLM.Search("SEARCHTEST1"); Assert.AreEqual(1, searchList.Count); BLM.DeleteTourGetList(searchList[0]); }
public ActionResult Delete(int id) { BusinessLayerManager blm = BusinessLayerManager.Instance; blm.SupprimerProduit(id); ProduitViewModel produitViewModel = new ProduitViewModel(); return(View("Index", produitViewModel)); }
public void Initialize() { blm = BusinessLayerManager.Instance; c = blm.GetAllCategorie().First(); prd = new Produit() { Code = 404, Libelle = "Balancoire", Description = "La boucave", Stock = 1000, Prix = 2000, CategorieId = c.Id, Categorie = c }; id = blm.AjouterProduit(prd); }
public ActionResult HandleForm(AddProduitViewModel p) { BusinessLayerManager blm = BusinessLayerManager.Instance; p.produit.Categorie = p.categories.Find(c => c.Id == p.produit.CategorieId); blm.ModifierProduit(p.produit); return(RedirectToAction("Index", "Home")); }
static void Main(string[] args) { BusinessLayerManager blm = BusinessLayerManager.Instance; List <Categorie> categories = blm.GetAllCategorie(); System.Console.WriteLine("LISTE DES CATEGORIES"); System.Console.WriteLine("{0}", categories.Count); foreach (Categorie c in categories) { System.Console.WriteLine("Catégorie ID {0} : {1}", c.Id, c.Libelle); } System.Console.WriteLine("Press enter to close..."); System.Console.ReadLine(); }
public ActionResult DeletProfile(EvernoteUser model) { EvernoteUser currentUser = Session["Login"] as EvernoteUser; BusinessLayerManager <EvernoteUser> res = evernoteUserManager.RemoveUserById(currentUser.Id); if (res.Errors.Count > 0) { ErrorViewModel message = new ErrorViewModel() { Items = res.Errors, Title = "Profil Silinemedi", RedicrtingUrl = "/Home/ShowProfile" }; } Session.Clear(); return(RedirectToAction("Index")); }
public ActionResult EditProfile() { EvernoteUser currentUser = Session["Login"] as EvernoteUser; BusinessLayerManager <EvernoteUser> res = evernoteUserManager.GetUserById(currentUser.Id); if (res.Errors.Count > 0) { ErrorViewModel errorNotify = new ErrorViewModel() { Title = "Hata Oluştu", Items = res.Errors }; return(View("Error", errorNotify)); } return(View(res.Result)); }
public ActionResult Edit(EvernoteUser evernoteUser) { ModelState.Remove("CreatedOn"); ModelState.Remove("ModifiedOn"); ModelState.Remove("ModifiedUsername"); if (ModelState.IsValid) { BusinessLayerManager <EvernoteUser> res = evernoteUserManager.Update(evernoteUser); if (res.Errors.Count > 0) { res.Errors.ForEach(x => ModelState.AddModelError("", x.Message)); return(View(evernoteUser)); } return(RedirectToAction("Index")); } return(View(evernoteUser)); }
public ActionResult UserActivate(Guid id) { BusinessLayerManager <EvernoteUser> res = evernoteUserManager.Active(id); if (res.Errors.Count > 0) { ErrorViewModel errorNotify = new ErrorViewModel() { Title = "Geçersiz İşlem", Items = res.Errors }; return(View("Error", errorNotify)); } OkViewModel okNotify = new OkViewModel() { Title = "Hesap Aktifleştirildi", RedicrtingUrl = "/Home/Login" }; okNotify.Items.Add("Hesabınız Aktifleştirildi Artık Not Paylaşabilir Beğeni yapabilirsiniz."); return(View("Ok", okNotify)); }
public ActionResult Register(RegisterViewModel model) { if (ModelState.IsValid) { BusinessLayerManager <EvernoteUser> res = evernoteUserManager.Registeruser(model); if (res.Errors.Count > 0) { res.Errors.ForEach(x => ModelState.AddModelError("", x.Message)); return(View(model)); } else { OkViewModel okNotify = new OkViewModel() { Title = "Kayıt Başarılı", RedicrtingUrl = "/Home/Login" }; okNotify.Items.Add("Lütfen E-Posta Adresinize Gelenaktivasyon Linkine Tıklayarak Hesabınızı Aktif Ediniz.HESABINIZI AKTİF ETMEDEN NOTE EKLEYEMEZ BEĞENİ YAPAMAZSINIZ"); return(View("Ok", okNotify)); } } return(View(model)); }
public ServiceECommerce() { this.blm = BusinessLayerManager.Instance; }
public void BusinessLayerManagerTest() { BusinessLayerManager blm = new BusinessLayerManager(); Assert.IsNotNull(blm); }