Exemplo n.º 1
0
        public async Task <IActionResult> Create(CreateSpecialityViewModel model)
        {
            if (ModelState.IsValid)
            {
                var name = model.Name;
                var dep  = await(from i in DBContext.Departments.Include(s => s.Specialities) where i.Id.ToString() == model.DepId select i).FirstOrDefaultAsync();


                var spec = new ESpeciality()
                {
                    Name = name
                };

                dep.Specialities.Add(spec);
                DBContext.Specialities.Add(spec);
                await DBContext.SaveChangesAsync();

                return(RedirectToAction("Index", new { DepId = model.DepId }));
            }

            return(View(model));
        }
Exemplo n.º 2
0
 public Student(string firstName, string middleName, string lastName, int sSN, string address, int phone, string email, ESpeciality speciality, EFaculty faculty, EUniversity university)
 {
     this.FirstName  = firstName;
     this.MiddleName = middleName;
     this.LastName   = lastName;
     this.SSN        = sSN;
     this.Address    = address;
     this.Phone      = phone;
     this.Email      = email;
     this.Speciality = speciality;
     this.Faculty    = faculty;
     this.University = university;
 }