Ejemplo n.º 1
0
 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));
 }
Ejemplo n.º 2
0
 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));
 }
Ejemplo n.º 3
0
        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));
        }
Ejemplo n.º 4
0
        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));
        }
Ejemplo n.º 5
0
        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));
        }
Ejemplo n.º 6
0
        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));
        }
Ejemplo n.º 7
0
        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));
        }