public ActionResult AddUser(User user, string BtnSubmit) { //CreateUserViewModel v = new CreateUserViewModel(); UserBusinessLayer userBusinessLayer = new UserBusinessLayer(); if (BtnSubmit == "添加") { userBusinessLayer.InsertUser(user); //userBusinessLayer.UpdataUsers(Session["User"].ToString(), user); //userBusinessLayer.InsertUser(user); } else if (BtnSubmit == "取消") { } return(RedirectToAction("Information")); }
public ActionResult SaveUser(User user, string BtnSubmit) { UserBusinessLayer userBusinessLayer = new UserBusinessLayer(); if (BtnSubmit == "提交更改") { userBusinessLayer.UpdataUsers(user.U_name, user); } else if (BtnSubmit == "添加") { userBusinessLayer.InsertUser(user); } return(RedirectToAction("Information")); //CreateUserViewModel v = new CreateUserViewModel(); //v.user = userBusinessLayer.GetUser(Session["User"].ToString()); //return PartialView("CreateUser", v); }
public ActionResult InitializeDatabase() { BusinessLayer <Equipment> ebl = new BusinessLayer <Equipment>(new CapaNavDocDal()); ebl.Insert(new Equipment { Ata = 72, MechanicsGroup = "moteurs pistons", Name = "Adaptateur Magnéto", Manufacturer = "TCM", PartNumber = "632653A1", MonitoringDate = SqlDateTime.MinValue.Value }); ebl.Insert(new Equipment { Ata = 74, MechanicsGroup = "Magnétos Unison", Name = "Magnétos Unison", Manufacturer = "Unison (ex Slick)", PartNumber = "4270", MonitoringDate = SqlDateTime.MinValue.Value }); UserBusinessLayer ubl = new UserBusinessLayer(); ubl.InsertUser(new User { LastName = "THOMAS", UserName = "******", FirstName = "Christophe", Password = "******" }); ubl.InsertUser(new User { FirstName = "Anna", LastName = "HASINA", Password = "******", UserName = "******" }); ubl.InsertUser(new User { FirstName = "Jean-Marc", LastName = "RAYNAUD", Password = "******", UserName = "******" }); ubl.InsertUser(new User { FirstName = "Jean-François", LastName = "SICARD", Password = "******", UserName = "******" }); ubl.InsertUser(new User { FirstName = "Régis", LastName = "VANDENBURIE", Password = "******", UserName = "******" }); BusinessLayer <Center> cbl = new BusinessLayer <Center>(new CapaNavDocDal()); cbl.Insert(new Center { Name = "Biscarrosse" }); cbl.Insert(new Center { Name = "Grenoble" }); cbl.Insert(new Center { Name = "Muret" }); cbl.Insert(new Center { Name = "Carcassonne" }); cbl.Insert(new Center { Name = "Castelnaudary" }); cbl.Insert(new Center { Name = "Montpellier" }); BusinessLayer <Action> abl = new BusinessLayer <Action>(new CapaNavDocDal()); abl.Insert(new Action { Description = "Réparation" }); abl.Insert(new Action { Description = "Inspection" }); abl.Insert(new Action { Description = "Révision Générale" }); abl.Insert(new Action { Description = "Réglage" }); BusinessLayer <ActivityField> afbl = new BusinessLayer <ActivityField>(new CapaNavDocDal()); afbl.Insert(new ActivityField { Description = "Moteur" }); afbl.Insert(new ActivityField { Description = "Cellule" }); afbl.Insert(new ActivityField { Description = "Radio" }); return(RedirectToAction("Index")); }