EmployeeEditJobDuties() 공개 메소드

public EmployeeEditJobDuties ( EmployeeEditJobDuties newItem ) : EmployeeWithJobDuties
newItem EmployeeEditJobDuties
리턴 EmployeeWithJobDuties
        public ActionResult EmployeeAndJobDuties(int?id, EmployeeEditJobDuties newItem)
        {
            // Validate the input
            if (!ModelState.IsValid)
            {
                // Our "version 1" approach is to display the "edit form" again
                return(RedirectToAction("edit", new { id = newItem.Id }));
            }

            if (id.GetValueOrDefault() != newItem.Id)
            {
                // This appears to be data tampering, so redirect the user away
                return(RedirectToAction("index"));
            }

            // Attempt to do the update
            var editedItem = m.EmployeeEditJobDuties(newItem);

            if (editedItem == null)
            {
                // There was a problem updating the object
                // Our "version 1" approach is to display the "edit form" again
                return(RedirectToAction("ByEmployee", new { id = newItem.Id }));
            }
            else
            {
                // Show the details view, which will have the updated data
                return(RedirectToAction("ByEmployeeWithJobDuties", new { id = newItem.Id }));
            }
        }