public async Task <IActionResult> Edit(int id, [Bind("EduQualificationId,EduQualificationName")] EduQualification eduQualification)
        {
            if (id != eduQualification.EduQualificationId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(eduQualification);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EduQualificationExists(eduQualification.EduQualificationId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(eduQualification));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            EduQualification eduQualification = db.EduQualifications.Find(id);

            db.EduQualifications.Remove(eduQualification);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "EduQualificationId,Type,Title,Institute,Class")] EduQualification eduQualification)
 {
     if (ModelState.IsValid)
     {
         db.Entry(eduQualification).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(eduQualification));
 }
        public async Task <IActionResult> Create([Bind("EduQualificationId,EduQualificationName")] EduQualification eduQualification)
        {
            if (ModelState.IsValid)
            {
                _context.Add(eduQualification);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(eduQualification));
        }
        public ActionResult Create([Bind(Include = "EduQualificationId,Type,Title,Institute,Class")] EduQualification eduQualification)
        {
            if (ModelState.IsValid)
            {
                db.EduQualifications.Add(eduQualification);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(eduQualification));
        }
        // GET: EduQualification/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            EduQualification eduQualification = db.EduQualifications.Find(id);

            if (eduQualification == null)
            {
                return(HttpNotFound());
            }
            return(View(eduQualification));
        }
Exemple #7
0
        /// <summary>
        /// Инициализация таблицы "Квалификация"
        /// </summary>
        /// <param name="serviceProvider"></param>
        /// <param name="configuration"></param>
        /// <returns></returns>
        public static async Task CreateEduQualification(IServiceProvider serviceProvider, IConfiguration configuration)
        {
            using (var serviceScope = serviceProvider.GetRequiredService <IServiceScopeFactory>().CreateScope())
            {
                AppIdentityDBContext context = serviceScope.ServiceProvider.GetService <AppIdentityDBContext>();

                #region Инициализация таблицы "Квалификация"
                if (!await context.EduQualification.AnyAsync())
                {
                    EduQualification EduQualification1 = new EduQualification
                    {
                        EduQualificationId   = 1,
                        EduQualificationName = "Специалист"
                    };

                    EduQualification EduQualification2 = new EduQualification
                    {
                        EduQualificationId   = 2,
                        EduQualificationName = "Бакалавр"
                    };

                    EduQualification EduQualification3 = new EduQualification
                    {
                        EduQualificationId   = 3,
                        EduQualificationName = "Магистр"
                    };

                    EduQualification EduQualification4 = new EduQualification
                    {
                        EduQualificationId   = 4,
                        EduQualificationName = "Исследователь. Преподаватель-исследователь"
                    };

                    EduQualification EduQualification5 = new EduQualification
                    {
                        EduQualificationId   = 5,
                        EduQualificationName = "Техник"
                    };

                    EduQualification EduQualification6 = new EduQualification
                    {
                        EduQualificationId   = 6,
                        EduQualificationName = "Специалист по земельно-имущественным отношениям"
                    };

                    EduQualification EduQualification7 = new EduQualification
                    {
                        EduQualificationId   = 7,
                        EduQualificationName = "Техник-электрик"
                    };

                    EduQualification EduQualification8 = new EduQualification
                    {
                        EduQualificationId   = 8,
                        EduQualificationName = "Бухгалтер"
                    };

                    EduQualification EduQualification9 = new EduQualification
                    {
                        EduQualificationId   = 9,
                        EduQualificationName = "Менеджер по продажам"
                    };

                    await context.EduQualification.AddRangeAsync(
                        EduQualification1,
                        EduQualification2,
                        EduQualification3,
                        EduQualification4,
                        EduQualification5,
                        EduQualification6,
                        EduQualification7,
                        EduQualification8,
                        EduQualification9
                        );

                    await context.SaveChangesAsync();
                }
                #endregion
            }
        }