Beispiel #1
0
        public IActionResult AddPeople(People people)
        {
            if (people.Name is null || people.Password is null)
            {
                return(RedirectToAction("Index"));
            }

            db.Peoples.Add(people);
            // сохраняем в бд все изменения
            db.SaveChanges();
            Customer = people;
            return(RedirectToAction("Index"));
        }
Beispiel #2
0
 public static void Initialize(TireFittingContext context)
 {
     if (!context.Peoples.Any())
     {
         context.Peoples.Add(
             new People
         {
             Name     = "Администратор",
             Phone    = "123",
             Password = "******"
         });
         context.SaveChanges();
     }
 }