Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("TotalHour,ListPrice,SavePrice,Id,IsActive,EducationId,LevelId,TimeId,CreDate")] StudentEducationEntity studentEducationEntity)
        {
            if (id != studentEducationEntity.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                studentEducationEntity.StudentId = StudentId;
                try
                {
                    await _studentEducationRepository.UpdateAsync(studentEducationEntity);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StudentEducationEntityExists(studentEducationEntity.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index), new { id = StudentId }));
            }
            return(View(studentEducationEntity));
        }
Пример #2
0
        public async Task <IActionResult> Create([Bind("TotalHour,ListPrice,SavePrice,Id,EducationId,LevelId,TimeId")] StudentEducationEntity studentEducationEntity)
        {
            if (ModelState.IsValid)
            {
                studentEducationEntity.StudentId = StudentId;
                await _studentEducationRepository.AddAsync(studentEducationEntity);

                return(RedirectToAction(nameof(Index), new { id = StudentId }));
            }
            return(View(studentEducationEntity));
        }