public string AddCustomer(FormCollection collection, Customer c) { Message = null; AMSEntities ae = new AMSEntities(); string uname = collection.Get("UserName"); string pwd = collection.Get("Password"); string repwd = collection.Get("ReTypePassword"); if (pwd == repwd) { using (TransactionScope ts = new TransactionScope()) { WebSecurity.CreateUserAndAccount(uname, pwd); Roles.AddUserToRole(uname, "Customer"); c.MembershipUserID = WebSecurity.GetUserId(uname); c.CustStatus = true; DataStore.Create(c); DataStore.SaveChanges(); Emailer.Send(c.CustEmail, "Registration confirmed", "Welcome to AMS"); ts.Complete(); }; Message = "Successfully Registered"; return Message; } else { return Message; } }
public ActionResult Create(FormCollection formCollection) { string title = formCollection.Get("Title"); string body = formCollection.Get("Body"); bool isPublic = formCollection.Get("IsPublic").Contains("true"); IRepository<Category> categoriesRepo = new CategoryRepository(); IRepository<Post> postsRepo = new PostRepository(); List<Category> allCategories = (List<Category>)categoriesRepo.GetAll(); Post post = new Post(); post.Body = body; post.Title = title; post.CreationDate = DateTime.Now; post.IsPublic = isPublic; foreach (Category category in allCategories) { if (formCollection.Get(category.Id.ToString()).Contains("true")) post.Categories.Add(category); } postsRepo.Save(post); return RedirectToAction("Index"); }
public ActionResult Create(FormCollection collection) { try { var idList = collection.Get("ids"); var idArray = idList.Split(",".ToCharArray()); if (idArray.Length > 0) { foreach (var item in idArray) { var priceLevelName = String.Format("price_level_name_{0}", item); var gPrice = String.Format("price_level_price_{0}", item); var name = collection.Get(priceLevelName); var price = collection.Get(gPrice); var priceLevel = new PriceLevel(); priceLevel.PriceLevelName = name; priceLevel.Price = Convert.ToDecimal(price); priceLevel.TeamId = Convert.ToInt64(collection.Get("TeamId")); priceLevel.SeasonId = Convert.ToInt64(collection.Get("SeasonId")); this.repo.Save(priceLevel); } } return RedirectToAction("Index", "PriceLevel"); } catch { return View(); } }
public ActionResult AddUserToRole(FormCollection collection) { ViewBag.Continental = (db.Continentals); if (collection != null) { string r = collection.Get("Role"); string u = collection.Get("User"); var UserRole = new ApplicationUserRole { RoleId = r,//"29b11ba5-a1cd-454a-aca5-a12f23e89764", UserId =u //"4caa7e95-8129-4c5c-be3f-b377c39f3bb3" }; try { db.ApplicationUserRoles.Add(UserRole); db.SaveChanges(); ViewData["Role"] = new SelectList(db.Roles, "Id", "Name"); ViewData["User"] = new SelectList(db.Users, "Id", "UserName"); return View(); } catch { ViewData["Role"] = new SelectList(db.Roles, "Id", "Name"); ViewData["User"] = new SelectList(db.Users, "Id", "UserName"); return View(); } } else { return HttpNotFound(); } }
public ActionResult Create(FormCollection collection) { try { var idList = collection.Get("ids"); var idArray = idList.Split(",".ToCharArray()); if (idArray.Length > 0) { foreach (var item in idArray) { var gamePriceName = String.Format("game_price_name_{0}", item); var gPrice = String.Format("game_price_price_{0}", item); var name = collection.Get(gamePriceName); var price = collection.Get(gPrice); var gamePrice = new GamePrice(); gamePrice.Price = Convert.ToDecimal(price); } } return RedirectToAction("Index", "Team"); } catch { return View(); } }
public ActionResult ChangePassword(FormCollection f) { int Id = int.Parse(Session["LogedUserID"].ToString()); string passold = f.Get("txtPassOld").ToString(); string passnew = f.Get("txtPassNew").ToString(); string passnewre = f.Get("txtPassNewRe").ToString(); User user = db.Users.Find(Id); if(user.Password.Equals(passold)) { if(passnew.Equals(passnewre)) { db.Users.Find(Id).Password = passnew; Session["Notify"] = "Bạn đã đổi mật khẩu thành công."; } else { Session["Notify"] = "Hai mật khẩu mới không trùng nhau."; } } else { Session["Notify"] = "Bạn đã nhập sai mật khẩu."; } return RedirectToAction("Profile", "User");; }
public ActionResult CreatePost(FormCollection f) { try { int Id_User = int.Parse(Session["LogedUserID"].ToString()); string Title = f.Get("txtTitle").ToString(); DateTime Date = DateTime.Now; string Content = f.Get("txtContent").ToString(); Forum_Post fp = new Forum_Post(); fp.Title = Title; fp.Id_User = Id_User; fp.Date = Date; fp.Content = Content; db.Forum_Post.Add(fp); db.SaveChanges(); return RedirectToAction("Forum", "Home"); } catch(Exception ex) { #region Ghi log log.Error(ex); #endregion return null; } }
public ActionResult Login(FormCollection fc) { string username = fc.Get("tbUsername"); string password = fc.Get("tbPassword"); string url = "/Home/"; VaKEGradeRepository repository = VaKEGradeRepository.Instance; Teacher teacher = repository.GetTeacher(username, password); if (teacher != null) { Session["User"] = teacher; if (username.ToLower() == "admin") { Session["Role"] = "Admin"; url = "/Admin/"; } else if (repository.IsUserClassTeacher(teacher)) { Session["Role"] = "ClassTeacher"; url = "/ClassTeacher/"; } else { Session["Role"] = "Teacher"; url = "/Teacher/"; } // VaKEGradeRepository.Instance.GetSubjectsOfTeacher(null, null); } return Redirect(url); }
public ActionResult Create(FormCollection collection) { var game = new Game(); try { var now = DateTime.Now; game.EventStartDate = CombineDateAndTime(collection.Get("EventStartDate"), collection.Get("EventStartTime")); game.EventEndDate = CombineDateAndTime(collection.Get("EventEndDate"), collection.Get("EventEndTime")); var loc = collection.Get("EventLocation"); if (!String.IsNullOrEmpty(loc)) { game.EventLocation = collection.Get("EventLocation"); } game.IsActive = true; game.VisitingTeamId = Convert.ToInt64(collection.Get("VisitingTeamId")); game.TeamId = Convert.ToInt64(collection.Get("TeamId")); game.TimeZone = collection.Get("TimeZone"); game.SeasonId = Convert.ToInt64(collection.Get("SeasonId")); game.DateCreated = now; game.DateUpdated = now; this.repo.Save(game); return RedirectToAction("Index"); } catch { ViewBag.Seasons = this.GetActiveSeasons(); ViewBag.TeamTypes = this.GetTeamTypes(); return View(game); } }
public ActionResult CreateBeerPosting(FormCollection form) { UserManager<ApplicationUser> manager = HttpContext.GetOwinContext().GetUserManager<ApplicationUserManager>(); string beer_name = form.Get("beerposting-name"); int beer_qty; Regex rx = new Regex("[0-9]+$"); if ((rx.IsMatch(form.Get("beerposting-quantity"))) && (!form.Get("beerposting-quantity").Contains("-"))) { beer_qty = Convert.ToInt32(form.Get("beerposting-quantity")); } else { System.Windows.Forms.MessageBox.Show("That's not a valid number. Please try again."); return RedirectToAction("Index"); } string beer_note = form.Get("beerposting-note"); string user_id = User.Identity.GetUserId(); string user_name = User.Identity.GetUserName(); ApplicationUser brewLover = hopCentral.Users.FirstOrDefault(u => u.Id == user_id); string brewLoverId = brewLover.Id; hopCentral.CreatePosting(brewLover, new BeerPosting { OwnerName = user_name, OwnerId = brewLoverId, BeerName = beer_name, Quantity = beer_qty, Note = beer_note }); return RedirectToAction("Index"); }
public ActionResult Captcha(FormCollection form) { var challenge = form.Get<string>("recaptcha_challenge_field", ""); var validator = new Recaptcha.RecaptchaValidator { PrivateKey = AppSettings.RecaptchaPrivateKey, RemoteIP = GetRemoteIP(), Challenge = challenge, Response = form.Get<string>("recaptcha_response_field", "") }; Recaptcha.RecaptchaResponse response; try { response = validator.Validate(); } catch (WebException) { // recaptcha is down - if the challenge had some length (it's usually a massive hash), allow the action - spam will be destroyed by the community response = challenge.Length >= 30 ? Recaptcha.RecaptchaResponse.Valid : Recaptcha.RecaptchaResponse.RecaptchaNotReachable; } if (response == Recaptcha.RecaptchaResponse.Valid) { Current.SetCachedObjectSliding(CaptchaKey(GetRemoteIP()), true, 60 * 15); return Json(new { success = true }); } return Json(new { success = false });; }
public ActionResult Create(FormCollection collection) { try { ServiceReference.JediWS jedi = new JediWS(); List<CaracteristiqueWS> caracList = new List<CaracteristiqueWS>(); using(ServiceReference.ServiceClient service = new ServiceClient()) { service.getCaracteristiques().ForEach(x => { if(x.Type == ServiceReference.ETypeCaracteristiqueWS.Jedi) { caracList.Add(x); } }); /* Item1. sur le champs du jedi parce que on a un tuple */ jedi.Id = 0; // Car creation jedi.Nom = Convert.ToString(collection.Get("Item1.Nom")); jedi.IsSith = Convert.ToBoolean(collection.Get("Item1.IsSith") != "false"); // Pour que ca marche bien jedi.Caracteristiques = new List<CaracteristiqueWS>(); // Pour init string[] checkboxes = collection.GetValues("caracteristiques"); if(checkboxes != null) { foreach(string s in checkboxes) { //On a que les ids des box selected, on ajoute les caracteristiques Int32 caracId = Convert.ToInt32(s); jedi.Caracteristiques.Add(caracList.First(x => x.Id == caracId)); } } service.addJedi(jedi); // Ajout du jedi } return RedirectToAction("Index"); // Retour a l'index } catch { return RedirectToAction("Index"); } }
public ActionResult Create(FormCollection collection) { try { string name = collection.Get("campaignname"); int x = -1; int y = -1; Int32.TryParse(collection.Get("fieldx"), out x); Int32.TryParse(collection.Get("fieldy"), out y); // Angemeldeten Spieler hinzufügen //PlayerInfo pinfo = data.getPlayerByName(User.Identity.Name); CampaignInfo newCampaignInfo = new CampaignInfo() { campaignId = "", campaignName = name, FieldDimension = new clsSektorKoordinaten() {X = x, Y = y}, ListPlayerInfo = new List<PlayerInfo>() { new PlayerInfo() { playerName = User.Identity.Name } } }; ICampaignController ctrl = data.createNewCampaign(newCampaignInfo); //ctrl.CampaignEngine.addPlayer(new Player(pinfo) { }); //data.safeCampaignState(ctrl.CampaignEngine.getState()); return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult Index(FormCollection collection) { TournoiWS ts = null; string nom = collection.Get(1); using (ServiceReference.ServiceClient service = new ServiceReference.ServiceClient()) { TournoiWS tn = service.getTournois().Where(x => x.Nom == nom).First(); ts = service.playTournoi(tn); } TournoiViewModel mod = new TournoiViewModel(ts); using (ServiceReference.ServiceClient service = new ServiceReference.ServiceClient()) { int butin = service.getPoints(User.Identity.GetUserName()); mod.Mise = Int32.Parse(collection.Get("Mise")); mod.Mise = (mod.Mise < 0 ? 0 : mod.Mise > butin ? butin : mod.Mise); mod.Jedi = collection.Get("Jedi"); bool gagne = mod.Jedi == mod.Matches.list.Where(x => x.Phase == EPhaseTournoiWS.Finale).First().JediVainqueur.Nom; mod.Gain = (gagne ? mod.Mise * 2 + 1 : 0); var userId = User.Identity.GetUserId(); mod.Total = service.getPoints(User.Identity.GetUserName()); mod.Total += (gagne ? mod.Gain : -mod.Mise); mod.Total = mod.Total < 0 ? 0 : mod.Total; service.setPoints(User.Identity.GetUserName(), mod.Total); } return View("Details", mod); }
public JsonResult Add(FormCollection form) { var sch = CheckGroup(form); bool week; int lessonId, lessonType, weekdayId; if (sch != null && bool.TryParse(form.Get("week"), out week) && int.TryParse(form.Get("lesson-id"), out lessonId) && int.TryParse(form.Get("lesson-type"), out lessonType) && int.TryParse(form.Get("weekday-id"), out weekdayId)) { sch.IsWeekOdd = week; sch.LessonId = lessonId; sch.LessonType = lessonType; sch.WeekdayId = weekdayId; sch.LectorName = _db.Lectors.Add(sch.LectorName); _db.Schedule.Add(sch); _db.Subjects.Add(sch.SubjectName); _db.Auditories.Add(sch.Auditory); _db.SaveChanges(); return Json(sch.SubjectName + " " + sch.Auditory); } return Json(null); }
public ActionResult Create(FormCollection collection) { try { ServiceReference.StadeWS stade = new StadeWS(); List<CaracteristiqueWS> caracList = new List<CaracteristiqueWS>(); using(ServiceReference.ServiceClient service = new ServiceClient()) { service.getCaracteristiques().ForEach(x => { if(x.Type == ServiceReference.ETypeCaracteristiqueWS.Stade) { caracList.Add(x); } }); /* Item1 parce qu'on a un Tuple */ stade.Id = 0; stade.Planete = Convert.ToString(collection.Get("Item1.Planete")); stade.NbPlaces = Convert.ToInt32(collection.Get("Item1.NbPlaces")); stade.Caracteristiques = new List<CaracteristiqueWS>(); string[] checkboxes = collection.GetValues("caracteristiques"); if(checkboxes != null) { foreach(string s in checkboxes) { Int32 caracId = Convert.ToInt32(s); stade.Caracteristiques.Add(caracList.First(x => x.Id == caracId)); } } service.addStade(stade); } return RedirectToAction("Index"); } catch { return RedirectToAction("Index"); } }
/// <summary> /// validiert die Formulareingaben auf Korrektheit /// </summary> /// <param name="formData">FormCollection mit den Formulareingaben aus dem Create-Formular</param> /// <param name="numExercises">Anzahl der Uebungen im Plan</param> /// <returns>true oder false</returns> public bool ValidateSessionFormData(FormCollection formData, int numExercises) { // workoutID und anzahl der Workouts muss numerisch sein byte dayID = 0; int workoutID = -1; if (!Byte.TryParse(formData.Get("dayID"), out dayID) || !Int32.TryParse(formData.Get("workoutID"), out workoutID)) return false; DateTime workoutDate = DateTime.MinValue; if (formData.Get("session-date").Trim() == "" || !DateTime.TryParse(formData.Get("session-date"), out workoutDate) || workoutDate == DateTime.MinValue) { return false; } // pruefen, dass alle Wiederholungs- und Gewichtszahlen numerisch und in einem gewissen Rahmen liegen int tmp = -1; double dtmp = -1.0; string[] weight, reps; for (int i = 0; i < numExercises; i++) { reps = formData.GetValues("reps-" + i); weight = formData.GetValues("weight-" + i); if ((reps != null || weight != null) && reps.Length != weight.Length) return false; for (int j = 0; j < reps.Length; j++) { if (!String.IsNullOrEmpty(reps[j].Trim()) && (!Int32.TryParse(reps[j], out tmp) || tmp < 0 || tmp > 1000)) return false; if (!String.IsNullOrEmpty(reps[j].Trim()) && (!Double.TryParse(weight[j], out dtmp) || dtmp < 0.0 || dtmp > 1000.0)) return false; if ((String.IsNullOrEmpty(reps[j].Trim()) && !String.IsNullOrEmpty(weight[j].Trim())) || (!String.IsNullOrEmpty(reps[j].Trim()) && String.IsNullOrEmpty(weight[j].Trim()))) return false; } } return true; }
public string RegistIn(FormCollection collection) { var userName = collection.Get("username"); var password = collection.Get("password"); var email = collection.Get("email"); var phone = collection.Get("phone"); if (string.IsNullOrEmpty(userName) || string.IsNullOrEmpty(password)) { return HttpRequestResult.StateNotNull; } var user = new User { UserName = userName, PassWord = password, Email = email, PhoneNum = phone, IsEnable = true, CreateTime = DateTime.Now, UpdateTime = DateTime.Now }; if (_userBll.Exists(user.UserName)) { return HttpRequestResult.StateExisted; } var flag = _userBll.Add(user); if (flag > 0) { return HttpRequestResult.StateOk; } return HttpRequestResult.StateError; }
public ActionResult Signin(FormCollection form) { var returnResult = new Swoopo.Model.JsonResult(); UserEntity userResult; try { var bll = new UserBll(); var user = new UserEntity { UserName = form.Get("UserName"), UserPwd = form.Get("UserPwd"), Email = "*****@*****.**" }; //由于登录时,不需要email,所有用“[email protected]”替代,否则验证无法通过 Validator<UserEntity> userValid = ValidationFactory.CreateValidator<UserEntity>(); ValidationResults r = userValid.Validate(user); if (!r.IsValid) { var list = r.Select(result => result.Message).ToList(); returnResult.error = list; return Json(returnResult); } user.UserPwd = We7Utils.MD5(user.UserPwd); userResult = bll.Signin(user); } catch (BllException ex) { #if DEBUG returnResult.error = ex.InnerException.Message; #else returnResult.error = ex.Message; #endif return Json(returnResult); } catch (DalException dalException) { #if DEBUG returnResult.error = dalException.InnerException.Message; #else returnResult.error = dalException.Message; #endif return Json(returnResult); } if (userResult == null) { //ModelState.AddModelError("", "用户名或密码不正确!"); //return View("Signin"); returnResult.error = "用户名或密码不正确!"; return Json(returnResult); } returnResult.value = true; Session["UserEntity"] = userResult; return Json(returnResult); }
public ActionResult CreateC(FormCollection f) { Category c = new Category(); c.Name = f.Get("txtName").ToString(); int Id_GroupCategory = Int32.Parse((f.Get("GroupCategory").ToString())); c.Id_Group_Category = Id_GroupCategory; db.Categories.Add(c); db.SaveChanges(); return RedirectToAction("ManagingDiscCategories", "Admin"); }
public IActionResult Create(System.Web.Mvc.FormCollection collection) { try { using (ModelosPuntoContext contexto = new ModelosPuntoContext()) { Patrones pat = new Patrones(); byte[] rutapatron = Encoding.ASCII.GetBytes(collection.Get("Patr")); //int a = pat.IdAutorPatron.Value; pat.NombrePatron = collection.Get("NombPatron"); pat.IdAutorPatron = Convert.ToInt32(collection.Get("Autorid")); //Conviertes a byte[] idat != null ? idat : null; pat.Patron = rutapatron != null ? rutapatron : null; pat.IdLana = Convert.ToInt32(collection.Get("Lanasid")); pat.IdPrendas = Convert.ToInt32(collection.Get("Prendasid")); pat.IdRevistas = Convert.ToInt32(collection.Get("Revistasid")); pat.IdTiposCaract = Convert.ToInt32(collection.Get("CaracId")); pat.IdTiposdeTejer = Convert.ToInt32(collection.Get("TiposTej")); pat.IdGenEdad = Convert.ToInt32(collection.Get("TiposTej")); contexto.Patrones.Add(pat); contexto.SaveChanges(); } return(IRedirectToActionResult("Index", "Home")); } catch (Exception ex) { //string a = ex.ToString(); return(View()); } }
public ActionResult AddDirectPaymentMethod(int Id_Order, FormCollection f) { Direct_Payment_Method directPM = new Direct_Payment_Method(); directPM.Id_Order = Id_Order; directPM.Shipping_Address = f.Get("txtAddressOrder").ToString(); directPM.Mobile = f.Get("txtMobileOrder").ToString(); db.Direct_Payment_Method.Add(directPM); db.SaveChanges(); Session["ShoppingCart"] = null; return RedirectToAction("Index", "Home"); }
/// <summary> /// speichert die Daten aus der FormCollection in einem Session-Datensatz ab /// </summary> /// <param name="formData"></param> public ml_Session Save(FormCollection formData, int userID) { ml_Session session = new ml_Session(); session.WorkoutID = Convert.ToInt32(formData.Get("workoutID")); session.UserID = userID; session.DayID = Convert.ToInt32(formData.Get("dayID")) + 1; session.CRDT = DateTime.Parse(formData.Get("session-date")); session.LUDT = DateTime.Now; _repo.Insert(session); return session; }
public ActionResult CreateList(FormCollection form) { string list_name = form.Get("list-name"); string board_id = form.Get("board-id"); Board current_board = repository.GetBoardById(int.Parse(board_id)); if (current_board != null) { repository.AddList(current_board.BoardId, new BrelloList { Title = list_name }); } return RedirectToAction("Index"); }
public ActionResult AddNewConcierge(FormCollection collection) { string name = collection.Get("newConciergeName"); string email = collection.Get("newConciergeEmail"); string password = collection.Get("newConciergePassword"); if (name == null) throw new Reop.Managers.Exceptions.ParamMissingException("Name is required"); if (email == null) throw new Reop.Managers.Exceptions.ParamMissingException("Email is required"); if (password == null) throw new Reop.Managers.Exceptions.ParamMissingException("Password is required"); UserLite newUser = new UserLite(); newUser.Credentials = new CredentialsLite(); newUser.Credentials.Email = email.Trim().ToLower(); newUser.Credentials.Password = Extensions.ExtensionMethods.ToSHA1EncodedString(password.Trim()); newUser.DisplayName = name.Trim(); newUser.Credentials.Username = email.Trim().ToLower(); newUser.RoleId = "2"; User registeredUser = null; try { registeredUser = _userManager.AddUser(newUser); } catch (Exception exp) { Trace.WriteLine("[ERROR] " + exp.StackTrace); } if (registeredUser != null) { try { // Agent has been registered, lets also create it on zendesk. long? zendeskId = _services.Ticketing.RegisterAgent(registeredUser, registeredUser.Credential.Email); bool registeredWithZendesk = _userManager.UpdateUserZendeskData(registeredUser.UserId, zendeskId, null); Trace.WriteLine(string.Format("Creation of ZENDESK AGENT user for {0} return {1}" , registeredUser.Credential.Email, registeredWithZendesk)); } catch (Exception e) { Trace.WriteLine("[ERROR] Failed to register user with Zendesk. EMAIL=" + registeredUser.Credential.Email); Trace.TraceError(e.Message); Trace.TraceError(e.StackTrace); } } //return JsonConvert.SerializeObject(new WebCookieLite(registeredUser)); return View("concierge"); }
public virtual ActionResult Delete(int id, FormCollection collection) { try { string productId = collection.Get("productId"); string idAsString = collection.Get("sprintId"); _SprintService.DeleteSprint(Int32.Parse(idAsString)); return RedirectToAction(Actions.ListByStartDateDesc(Int32.Parse(productId))); } catch { return View(); } }
public ActionResult DangNhap(FormCollection f) { string user = f.Get("txtTaiKhoan").ToString(); string pwd = f.Get("txtMatKhau").ToString(); User us = db.Users.SingleOrDefault(n => n.Name == user && n.Pwd == pwd); if(us != null) { ViewBag.ThongBao = "Chúc mừng đăng nhập thành công"; Session["Username"] = us; return View(); } ViewBag.ThongBao = "Tên tài khoản hoặc mật khẩu không đúng"; return View(); }
public string Edit(FormCollection form) { var retVal = string.Empty; var operation = form.Get("oper"); var id = ConvertHelper.ToInt32(form.Get("Id")); WebServiceConfigInfo info; switch (operation) { case "edit": info = WebServiceConfigRepository.GetInfo(id); if (info != null) { info.Value = form.Get("Value"); info.Type = form.Get("Type").ToInt32(); info.BranchId = form.Get("BranchId").ToInt32(); WebServiceConfigRepository.Update(info); } break; case "add": info = new WebServiceConfigInfo { Value = form.Get("Value"), Type = form.Get("Type").ToInt32(), BranchId = form.Get("BranchId").ToInt32(), }; WebServiceConfigRepository.Create(info); break; case "del": WebServiceConfigRepository.Delete(id); break; } return retVal; }
public ActionResult Edit(int id, FormCollection collection) { try { Product product = new Product(collection.Get("name"), collection.Get("description"), int.Parse(collection.Get("bid"))); product.id = id; productsDB.updateProduct(product); return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult Create(FormCollection collection) { var season = new Season(); try { var now = DateTime.Now; season.EventStartDate = Convert.ToDateTime(collection.Get("EventStartDate")); season.EventEndDate = Convert.ToDateTime(collection.Get("EventEndDate")); season.EventLocation = collection.Get("EventLocation"); season.IsActive = true; season.IsArchived = false; season.Opponent = collection.Get("Opponent"); season.SeasonTypeId = Convert.ToInt32(collection.Get("SeasonTypeId")); season.TeamId = Convert.ToInt64(collection.Get("TeamId")); season.TimeZone = collection.Get("TimeZone"); season.SeasonYearsId = this.GetSeasonYearsId(collection.Get("SeasonYearsId")); season.DateCreated = now; season.DateUpdated = now; this.seasonRepo.Save(season); return RedirectToAction("Index"); } catch { ViewBag.TeamTypes = this.GetTeamTypes(); ViewBag.SeasonTypes = this.GetTeamTypes(); return View(season); } }
public ActionResult Login(FormCollection f) { string user = f.Get("txtUser").ToString(); string pwd = f.Get("txtPwd").ToString(); Staff stf = db.Staffs.SingleOrDefault(n => n.Username == user && n.Password == pwd); if (stf != null) { ViewBag.Thongbao = "Success"; Session["Username"] = stf; return View(); } ViewBag.Thongbao = "Failed"; return View(); }