public CathedraViewModel(IUserInterop userInterop, IControllerInterop controllerInterop, Dispatcher dispatcher, CathedraDTO cathedra)
            : base(userInterop, controllerInterop, dispatcher)
        {
            faculties = new List<FacultyDTO>();

            originalEntity = cathedra;
        }
 public GroupModel(GroupDTO group)
     : base(group)
 {
     this.cathedra = group.Cathedra;
     this.specialization = group.Specialization;
     this.cathedraId = group.CathedraID;
     this.specializationId = group.SpecializationID;
 }
Exemple #3
0
        public async Task <IActionResult> AddNewCathedra(AddCathedraModel model)
        {
            CathedraDTO newItem = new CathedraDTO()
            {
                cathedraName = model.nameCathedra,
                facultyName  = model.nameFaculty,
            };

            await cathedra.Create(newItem);

            return(RedirectToAction("GetCathedra", "EducationalDepartment"));
        }
        public async Task <OperationDetails> Create(CathedraDTO itemDTO)
        {
            Cathedra newItem = new Cathedra()
            {
                cathedraName = itemDTO.cathedraName,
                ID_faculty   = Database.RFaculties.Get(itemDTO.facultyName).IdFaculty
            };

            Database.RCathedra.Create(newItem);
            await Database.Save();

            return(new OperationDetails(true, "Registration success", ""));
        }
        public CathedraDTO FindCathedra(string name)
        {
            Cathedra    item    = Database.RCathedra.Get(name);
            CathedraDTO itemDTO = null;

            if (item != null)
            {
                itemDTO = new CathedraDTO();

                itemDTO.Id_Cathedra  = item.IdCathedra;
                itemDTO.cathedraName = item.cathedraName;
                itemDTO.facultyName  = Database.RCathedra.GetAll().Where(x => x.IdCathedra == item.IdCathedra).SingleOrDefault().cathedraName;
            }

            return(itemDTO);
        }