public async Task <IActionResult> PutUser(Guid id, User user)
        {
            if (id != user.UserId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Ejemplo n.º 2
0
 public ActionResult EditLecture(Lecture lecture)
 {
     lecture.date = DateTime.Now;
     lectureContext.Entry(lecture).State = EntityState.Modified;
     lectureContext.SaveChanges();
     return(RedirectToAction("Index"));
 }
        public async Task <IActionResult> PutLecture(Guid id, Lecture lecture)
        {
            if (id != lecture.LectureId)
            {
                return(BadRequest());
            }

            _context.Lecture.Update(lecture);
            _context.Entry(lecture).State = EntityState.Modified;

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

            return(NoContent());
        }