public ActionResult Edit([Bind(Include = "Id,UserName,Nazwa,PoczątekSłużby,ZakończenieSłużby,StartSłużby,KoniecSłużby,Obsługa,UwagiDyspozytora")] ServicePlan servicePlan) { if (ModelState.IsValid) { db.Entry(servicePlan).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(servicePlan)); }
public ActionResult Edit([Bind(Include = "Id,UserName,Imię,Nazwisko,Miasto,Zakład")] Profile profile) { if (ModelState.IsValid) { db.Entry(profile).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(profile)); }
public ActionResult Create([Bind(Include = "Id,Nazwa,Od,Do,Odcinek,Szczegóły")] WarningsList warningsList) { if (ModelState.IsValid) { db.Warningslist.Add(warningsList); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(warningsList)); }
public ActionResult Create([Bind(Include = "Id,Kategoria,Numer,Nazwa,StacjaPoczątkowa,StacjaKońcowa,Odjazd,Przyjazd,Obsługa,Uwagi")] Timetables timetables) { if (ModelState.IsValid) { db.Timetables.Add(timetables); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(timetables)); }
public ActionResult Create([Bind(Include = "Id,SeriaPociągu,NumerPociągu,Stacja,Rewizja,Adnotacje")] Trains trains) { if (ModelState.IsValid) { HttpPostedFileBase file = Request.Files["loco"]; if (file != null && file.ContentLength > 0) { trains.Foto = file.FileName; file.SaveAs(HttpContext.Server.MapPath("~/Images/") + trains.Foto); } db.Trains.Add(trains); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(trains)); }
public ActionResult Create([Bind(Include = "Id,UserName,Nazwa,NumerSkładu,SeriaPociągu,NumerPociągu,UwagiDyspozytora")] ServicePlan servicePlan) { if (ModelState.IsValid) { MasterProjectContext db = new MasterProjectContext(); db.ServicePlans.Add(servicePlan); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(servicePlan)); }
public async Task <ActionResult> Register(RegisterViewModel model) { if (ModelState.IsValid) { var user = new ApplicationUser { UserName = model.Email, Email = model.Email }; var result = await UserManager.CreateAsync(user, model.Password); if (result.Succeeded) { await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false); Profile profile = new Profile { UserName = model.Email, Imię = model.Imię, Nazwisko = model.Nazwisko, Miasto = model.Miasto, Zakład = model.Zakład }; ServicePlan servicePlan = new ServicePlan { UserName = model.Email }; MasterProjectContext db = new MasterProjectContext(); db.Profiles.Add(profile); db.SaveChanges(); // Aby uzyskać więcej informacji o sposobie włączania potwierdzania konta i resetowaniu hasła, odwiedź stronę https://go.microsoft.com/fwlink/?LinkID=320771 // Wyślij wiadomość e-mail z tym łączem // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id); // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme); // await UserManager.SendEmailAsync(user.Id, "Potwierdź konto", "Potwierdź konto, klikając <a href=\"" + callbackUrl + "\">tutaj</a>"); return(RedirectToAction("Login", "Account")); } AddErrors(result); } // Dotarcie do tego miejsca wskazuje, że wystąpił błąd, wyświetl ponownie formularz return(View(model)); }