Esempio n. 1
0
        public async Task <IActionResult> PutAspirant([FromRoute] int id, [FromBody] Aspirant aspirant)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != aspirant.Id)
            {
                return(BadRequest());
            }

            _context.Entry(aspirant).State = EntityState.Modified;

            try {
                await _context.SaveChangesAsync();
            } catch (DbUpdateConcurrencyException) {
                if (!AspirantExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Esempio n. 2
0
        public async Task <IActionResult> Post([FromBody] Faculty faculty)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            _context.Faculties.Add(faculty);
            await _context.SaveChangesAsync();

            return(Ok(faculty.Id));
        }
Esempio n. 3
0
        public async Task <IActionResult> Create([Bind("Id,Name,Surename,Patronymic,Birthday,DateInput,ProtectionDate,Protection,Course,StatustypeId")] Aspirant aspirant)
        {
            if (ModelState.IsValid)
            {
                _context.Add(aspirant);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["StatustypeId"] = new SelectList(_context.Statuses, "Id", "Name");                             // Custom
            return(View(aspirant));
        }
Esempio n. 4
0
        public async Task <IActionResult> Create([Bind("Id,Code,Name,KnowledgeId")] Speciality speciality)
        {
            if (ModelState.IsValid)
            {
                _context.Add(speciality);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["KnowledgeId"] = new SelectList(_context.Knowledges, "Id", "Name", speciality.KnowledgeId);                // Custom
            return(View(speciality));
        }
Esempio n. 5
0
        public async Task <IActionResult> Create([Bind("Id,Name,Surename,Patronymic,Birthday,DateInput,ProtectionDate,Protection,Course,StatustypeId,SpecialityId")] Aspirant aspirant)
        {
            if (ModelState.IsValid)
            {
                _context.Add(aspirant);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }                                                                                                                             // Custom
            PopulateStatusesDropDownList(aspirant.StatustypeId);
            return(View(aspirant));
        }
Esempio n. 6
0
        public async Task <IActionResult> CreateAsync([Bind("Id,Number,Date,OrdertypeId,Aspirants")] Order order)
        {
            if (ModelState.IsValid)
            {
                //Order order = new Order { Number = orderVM.Number, Date=orderVM.Date, OrdertypeId=orderVM.OrdertypeId};

                // if (order.OrderType.Id == (int)OrderTypeEnum.Переведення)
                //

                _context.Add(order);
                await _context.SaveChangesAsync();
                await AddOrUpdateAssignedAspirants(order);

                return(RedirectToAction(nameof(Index)));
            }

            PopulateOrdertypesDropDownList(order.OrdertypeId);
            return(View(order));
        }
Esempio n. 7
0
        public async Task <IActionResult> Post([FromBody] Prepod prepod)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            prepod.DepartmentsString = GetDepartmentsString(prepod);

            _context.Prepods.Add(prepod);
            await _context.SaveChangesAsync();

            await EditAssignedDepartments(prepod);

            return(Ok(prepod.Id));
        }
Esempio n. 8
0
        public async Task <IActionResult> Post([FromBody] Department department)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            _context.Departments.Add(department);
            await _context.SaveChangesAsync();

            await AddAssignedSpecialities(department);

            return(Ok(department.Id));
        }