public Doctor(int doctorID, string name, string surname, AcademicDegrees academicDegree, MedicalSpecializations specialization, DateTime dateOfEmployment, JobPositions jobPosition) : base(doctorID.ToString(), "Id_Lekarza", new List <string> { }) { Name = name; Surname = surname; _AcademicDegree = academicDegree; _MedicalSpecialization = specialization; DateOfEmployment = dateOfEmployment; _JobPosition = jobPosition; }
public int AddAcademicDegrees(AcademicDegrees data) { var checkNumber = _context.AcademicDegrees.Any(x => x.title == data.title); if (checkNumber) { return(-1); } var res = _context.AcademicDegrees.Add(data); _context.SaveChanges(); return(res.Entity.id); }
public IActionResult PutAcademicDegrees(int id, [FromBody] AcademicDegrees data) { try { var res = _repository.UpdateAcademicDegrees(id, data); if (!res) { return(Conflict(409)); } return(Ok(res)); } catch (Exception error) { return(BadRequest(error)); } }
public IActionResult PostAcademicDegrees(AcademicDegrees data) { try { var res = _repository.AddAcademicDegrees(data); if (res == -1) { return(Conflict(409)); } return(Ok(res)); } catch (Exception error) { return(BadRequest(error)); } }
public bool UpdateAcademicDegrees(int id, AcademicDegrees data) { var res = _context.AcademicDegrees.FirstOrDefault(x => x.id == id); if (res == null) { return(false); } var checkNumber = _context.AcademicDegrees.Where(x => x.id != id).Any(x => x.title == data.title); if (checkNumber) { return(false); } res.title = data.title; _context.SaveChanges(); return(true); }
public Program(string name, AcademicDegrees degreesOffered, string departmentHeadFullName) { this.name = name; this.degreesOffered = degreesOffered; this.departmentHeadFullName = departmentHeadFullName; }
//Заполнение всех списков значениями private async void GetTables() => await Task.Run(() => { Organizations = (List <Organization>)NirsSystem.GetListObject <Organization>(); if (Organizations == null) { Organizations = new List <Organization>(); } Organizations.Insert(0, new Organization { OrganizationId = 0, OrganizationName = "(пусто)" }); SelectedOrganization = Organizations.FirstOrDefault(u => u.OrganizationId == _author.OrganizationId); OnPropertyChanged("Organizations"); OnPropertyChanged("SelectedOrganization"); Faculties = (List <Faculty>)NirsSystem.GetListObject <Faculty>(); if (Faculties == null) { Faculties = new List <Faculty>(); } Faculties.Insert(0, new Faculty { FacultyId = 0, FacultyName = "(пусто)" }); SelectedFaculty = Faculties.FirstOrDefault(u => u.FacultyId == _author.FacultyId); OnPropertyChanged("Faculties"); OnPropertyChanged("SelectedFaculty"); Departments = (List <Department>)NirsSystem.GetListObject <Department>(); if (Departments == null) { Departments = new List <Department>(); } Departments.Insert(0, new Department { DepartmentId = 0, DepartmentName = "(пусто)" }); SelectedDepartment = Departments.FirstOrDefault(u => u.DepartmentId == _author.DepartmentId); OnPropertyChanged("Departments"); OnPropertyChanged("SelectedDepartment"); Groups = (List <Group>)NirsSystem.GetListObject <Group>(); if (Groups == null) { Groups = new List <Group>(); } Groups.Insert(0, new Group { GroupId = 0, GroupName = "(пусто)" }); SelectedGroup = Groups.FirstOrDefault(u => u.GroupId == _author.GroupId); OnPropertyChanged("Groups"); OnPropertyChanged("SelectedGroup"); Positions = (List <Position>)NirsSystem.GetListObject <Position>(); if (Positions == null) { Positions = new List <Position>(); } Positions.Insert(0, new Position { PositionId = 0, PositionName = "(пусто)" }); SelectedPosition = Positions.FirstOrDefault(u => u.PositionId == _author.PositionId); OnPropertyChanged("Positions"); OnPropertyChanged("SelectedPosition"); AcademicDegrees = (List <AcademicDegree>)NirsSystem.GetListObject <AcademicDegree>(); if (AcademicDegrees == null) { AcademicDegrees = new List <AcademicDegree>(); } AcademicDegrees.Insert(0, new AcademicDegree { AcademicDegreeId = 0, AcademicDegreeName = "(пусто)" }); SelectedAcademicDegree = AcademicDegrees.FirstOrDefault(u => u.AcademicDegreeId == _author.AcademicDegreeId); OnPropertyChanged("AcademicDegrees"); OnPropertyChanged("SelectedAcademicDegree"); });