public async Task <IActionResult> Edit(int id, [Bind("DisciplineNameId,DisciplineNameName")] DisciplineName disciplineName) { if (id != disciplineName.DisciplineNameId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(disciplineName); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DisciplineNameExists(disciplineName.DisciplineNameId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(disciplineName)); }
public Discipline(DisciplineName name, int numberOfLectures, int numberOfExercies) { this.Name = name; this.NumberOfLectures = numberOfLectures; this.NumberOfExercies = numberOfExercies; this.Comment = comment; }
public Discipline(DisciplineName name, uint lecturesCount, uint exercisesCount, string comment = null) { this.Name = name; this.LecturesCount = lecturesCount; this.ExercisesCount = exercisesCount; this.Comment = comment; }
// constructor public Disciplines(DisciplineName name, int lectures, int exercises, string comment = null) { this.Name = name; this.NumberOfLectures = lectures; this.NumberOfExercies = exercises; this.Comment = comment; }
// class's constructor. Exception is being thrown if invalid parameters are entered public Discipline(DisciplineName name, int numOfLectures, int numOfExercises) { this.name = name; this.numberOfLectures = numOfLectures; this.numberOfExercises = numOfExercises; if (this.numberOfExercises <= 0 || this.numberOfLectures <= 0) throw new ArgumentException("Discipline horrarium mismatch"); }
// class's constructor. Exception is being thrown if invalid parameters are entered public Discipline(DisciplineName name, int numOfLectures, int numOfExercises) { this.name = name; this.numberOfLectures = numOfLectures; this.numberOfExercises = numOfExercises; if (this.numberOfExercises <= 0 || this.numberOfLectures <= 0) { throw new ArgumentException("Discipline horrarium mismatch"); } }
public async Task <IActionResult> Create([Bind("DisciplineNameId,DisciplineNameName")] DisciplineName disciplineName) { if (ModelState.IsValid) { _context.Add(disciplineName); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(disciplineName)); }
/// <summary> /// Добавляет дисциплину в справочник наименований дисциплин /// </summary> /// <param name="disciplineName"></param> /// <param name="userName"></param> /// <returns></returns> public async Task CreateDisciplineNameByUserNameAsync(string disciplineName, string userName) { var metodKomissii = await GetMetodKomissiiByUserNameAsync(userName); if (metodKomissii.Count() > 0) { if (_context.DisciplineNames.Where(n => n.DisciplineNameName.ToLower() == disciplineName.ToLower()).Count() > 0) { return; } disciplineName = disciplineName.Trim(); var disciplineNameNewObject = new DisciplineName { DisciplineNameName = disciplineName }; await _context.DisciplineNames.AddAsync(disciplineNameNewObject); await _context.SaveChangesAsync(); } }
public Discipline(DisciplineName name, int numberOfLectures, int numberOfExercies, string comment) { this.Name = name; this.NumberOfLectures = numberOfLectures; this.NumberOfExercies = numberOfExercies; }
public Discipline(DisciplineName name, byte numberOfLectures, byte numberOfExercises, string comments) : this(name, numberOfLectures, numberOfExercises) { this.Comments = comments; }
public Discipline(DisciplineName name, byte numberOfLectures, byte numberOfExercises) { this.Name = name; this.NumberOfLectures = numberOfLectures; this.NumberOfExercises = numberOfExercises; }
public override int GetHashCode() { return((DisciplineName?.GetHashCode() ?? 0 * 397) ^ ((int)ControlType * 397) ^ (GroupName?.GetHashCode() ?? 0)); }
// public List<string> Comments;???? public Discipline(DisciplineName name) { this.Name = name; }
/// <summary> /// Инициализация таблицы "Дисциплины" /// </summary> /// <param name="serviceProvider"></param> /// <param name="configuration"></param> /// <returns></returns> public static async Task CreateDisciplineName(IServiceProvider serviceProvider, IConfiguration configuration) { using (var serviceScope = serviceProvider.GetRequiredService <IServiceScopeFactory>().CreateScope()) { AppIdentityDBContext context = serviceScope.ServiceProvider.GetService <AppIdentityDBContext>(); #region Инициализация таблицы "Дисциплины" if (!await context.DisciplineNames.AnyAsync()) { DisciplineName DisciplineName1 = new DisciplineName { DisciplineNameId = 1, DisciplineNameName = "Иностранный язык" }; DisciplineName DisciplineName2 = new DisciplineName { DisciplineNameId = 2, DisciplineNameName = "Философия" }; DisciplineName DisciplineName3 = new DisciplineName { DisciplineNameId = 3, DisciplineNameName = "История" }; DisciplineName DisciplineName4 = new DisciplineName { DisciplineNameId = 4, DisciplineNameName = "Математика" }; DisciplineName DisciplineName5 = new DisciplineName { DisciplineNameId = 5, DisciplineNameName = "Информатика" }; DisciplineName DisciplineName6 = new DisciplineName { DisciplineNameId = 6, DisciplineNameName = "Физика" }; DisciplineName DisciplineName7 = new DisciplineName { DisciplineNameId = 7, DisciplineNameName = "Химия" }; DisciplineName DisciplineName8 = new DisciplineName { DisciplineNameId = 8, DisciplineNameName = "Начертательная геометрия. Инженерная графика" }; DisciplineName DisciplineName9 = new DisciplineName { DisciplineNameId = 9, DisciplineNameName = "Физическая культура" }; await context.DisciplineNames.AddRangeAsync( DisciplineName1, DisciplineName2, DisciplineName3, DisciplineName4, DisciplineName5, DisciplineName6, DisciplineName7, DisciplineName8, DisciplineName9 ); await context.SaveChangesAsync(); } #endregion } }