コード例 #1
0
        public async Task <IActionResult> PutStudent(int id, Student student)
        {
            if (id != student.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
コード例 #2
0
        public async Task <IActionResult> PutItem([FromRoute] int id, [FromBody] Item item)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != item.ID)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
コード例 #3
0
 public ActionResult Edit([Bind(Include = "RoomId,Name")] Room room)
 {
     if (ModelState.IsValid)
     {
         db.Entry(room).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(room));
 }
コード例 #4
0
 public ActionResult Edit([Bind(Include = "Id,Nome,Telefone,CPF")] Cliente cliente)
 {
     if (ModelState.IsValid)
     {
         db.Entry(cliente).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(cliente));
 }
コード例 #5
0
 public ActionResult Edit([Bind(Include = "ID,Name,School,StartDate,EndDate")] Education education)
 {
     if (ModelState.IsValid)
     {
         db.Entry(education).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(education));
 }
コード例 #6
0
ファイル: SkillsController.cs プロジェクト: sebstrand123/MVC
 public ActionResult Edit([Bind(Include = "ID,Description")] Skills skills)
 {
     if (ModelState.IsValid)
     {
         db.Entry(skills).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(skills));
 }
コード例 #7
0
ファイル: PeopleController.cs プロジェクト: sebstrand123/MVC
 public ActionResult Edit([Bind(Include = "ID,Name,Address,City,ZipCode,PhoneNumber,Email")] Person person)
 {
     if (ModelState.IsValid)
     {
         db.Entry(person).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(person));
 }
コード例 #8
0
 public ActionResult Edit([Bind(Include = "ID,WorkRole,CompanyName,StartDate,EndDate,Description")] Experience experience)
 {
     if (ModelState.IsValid)
     {
         db.Entry(experience).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(experience));
 }
コード例 #9
0
ファイル: StudentController.cs プロジェクト: msluka/Study
        public ActionResult Edit(Student std)
        {
            var db = new MVCContext();

            if (ModelState.IsValid)
            {
                db.Entry(std).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(std));
        }