public async Task <IActionResult> Edit(int id, [Bind("Id,Value,BRStudentId,UserId")] BRStudentGrade bRStudentGrade) { if (id != bRStudentGrade.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(bRStudentGrade); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BRStudentGradeExists(bRStudentGrade.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["BRStudentId"] = new SelectList(_context.BRStudent, "Id", "Id", bRStudentGrade.BRStudentId); ViewData["UserId"] = new SelectList(_context.Users, "Id", "Id", bRStudentGrade.UserId); return(View(bRStudentGrade)); }
public async Task <IActionResult> CreateStudentGradeAsync([Bind("Value,Opinion,Question,BRStudentId,UserId")] BRStudentGrade bRStudentGrade) { string userName = UserManager.GetUserName(HttpContext.User); var studentIin = await Context.BRStudent .Where(x => x.Id == bRStudentGrade.BRStudentId) .Select(x => x.Iin) .FirstOrDefaultAsync(); if (ModelState.IsValid) { Context.Update(bRStudentGrade); await Context.SaveChangesAsync(); ////// DAUREN: ADDING USER LOGS UserActivity userActivity = new UserActivity() { UserName = userName, TimeStamp = DateTime.Now, Activity = "Выставление оценки", Description = $"Пользователь {userName} поставил оценку {bRStudentGrade.Value} студенту {studentIin.ToString()} в {DateTime.Now}" }; Context.Add(userActivity); await Context.SaveChangesAsync(); ///*** return(RedirectToAction(nameof(Success))); } return(View(bRStudentGrade)); }
public async Task <IActionResult> CreateBRStudentGrade([Bind("Value,BRStudentId,UserId")] BRStudentGrade bRStudentGrade) { if (ModelState.IsValid) { Context.Update(bRStudentGrade); await Context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(bRStudentGrade)); }
public async Task <IActionResult> Create([Bind("Id,Value,BRStudentId,UserId")] BRStudentGrade bRStudentGrade) { if (ModelState.IsValid) { _context.Add(bRStudentGrade); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["BRStudentId"] = new SelectList(_context.BRStudent, "Id", "Id", bRStudentGrade.BRStudentId); ViewData["UserId"] = new SelectList(_context.Users, "Id", "Id", bRStudentGrade.UserId); return(View(bRStudentGrade)); }