Beispiel #1
0
        public async Task <IActionResult> PutAuthenticationUser([FromRoute] int id, [FromBody] AuthenticationUser authenticationUser)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(NoContent());
        }
Beispiel #2
0
        public async Task <IActionResult> PutCourseAssignments([FromRoute] string id, [FromBody] CourseAssignments courseAssignments)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != courseAssignments.Assignment_Name)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
 public ActionResult Edit([Bind(Include = "Id,Name,Address")] Manufacturer manufacturer)
 {
     if (ModelState.IsValid)
     {
         db.Entry(manufacturer).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(manufacturer));
 }