Beispiel #1
0
        public async Task <IActionResult> Edit([FromBody] CourseNote courseNote)
        {
            if (courseNote == null)
            {
                return(Json(new { success = false }));
            }

            courseNote.modifiedDate = DateTime.UtcNow;
            _context.Update(courseNote);
            await _context.SaveChangesAsync();

            return(Json(new { success = true }));
        }
        public async Task <IActionResult> Edit(int id, [Bind("CourseId,name,description,department,number,semeseter,year, professor, professorEmail")] Course course)
        {
            //if (id != course.CourseId)
            //{
            //    return NotFound();
            //}

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(course);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CourseExists(course.CourseId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Details", new { id = course.CourseId }));
            }
            return(View(course));
        }
Beispiel #3
0
        public async Task <IActionResult> Edit(int id, [Bind("LearningOutcomeId,name,description,CourseNum")] LearningOutcome learningOutcome)
        {
            //if (id != learningOutcome.LearningOutcomeId)
            //{
            //    return NotFound();
            //}

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(learningOutcome);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LearningOutcomeExists(learningOutcome.LearningOutcomeId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("ByCourse", new { number = learningOutcome.CourseNum }));
            }
            return(View(learningOutcome));
        }
        public async Task <IActionResult> Edit([FromBody] LearningOutcomeNote learningOutcomeNote)
        {
            if (learningOutcomeNote == null)
            {
                return(Json(new { success = true }));
            }

            learningOutcomeNote.modifiedDate = DateTime.UtcNow;
            IdentityUser user = await _userManager.GetUserAsync(HttpContext.User);

            bool role = await _userManager.IsInRoleAsync(user, "Chair");

            if (role)
            {
                learningOutcomeNote.lastEditChair = true;
            }
            else
            {
                learningOutcomeNote.lastEditChair = false;
            }
            _context.Update(learningOutcomeNote);
            await _context.SaveChangesAsync();

            return(Json(new { success = true }));
        }