コード例 #1
0
 public ActionResult Edit([Bind(Include = "Id,Name,Telephone,Email,Age,Gender,Reason,FavoriteAnimals,StaffNumber,Password")] Staff staff)
 {
     if (ModelState.IsValid)
     {
         db.Entry(staff).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(staff));
 }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "Staff_ID,Staff_Name,DoB,Bank_Acc,Street_Add,Block_No,Postal_Code,Country,Phone_No")] Staff staff)
 {
     if (ModelState.IsValid)
     {
         db.Entry(staff).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(staff));
 }
コード例 #3
0
        public async Task <IActionResult> PutStaff(int id, Staff staff)
        {
            staff.id = id;

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

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

            return(NoContent());
        }