示例#1
0
 public ActionResult EditDepartment([Bind(Include = "DepartmentId,Name,DateOfAdding,DateInfoChanging")] Department department)
 {
     if (ModelState.IsValid)
     {
         db.Entry(department).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("ShowDepartments"));
     }
     return(View(department));
 }
        public async Task <IHttpActionResult> PutDepartment(int id, Department department)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != department.DepartmentID)
            {
                return(BadRequest());
            }

            db.Entry(department).State = EntityState.Modified;

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
示例#3
0
        public async Task <IActionResult> PutEmployee(int id, Employee employee)
        {
            if (id != employee.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
示例#4
0
        public async Task <IActionResult> PutDepartment(int id, Department department)
        {
            if (id != department.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
示例#5
0
        public async Task <IActionResult> PutWorker(int id, Worker worker)
        {
            if (id != worker.WorkerId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <IHttpActionResult> PutEmployees(int id, Employees employees)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != employees.EmployeeID)
            {
                return(BadRequest());
            }

            db.Entry(employees).State = EntityState.Modified;

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
示例#7
0
        public PartialViewResult UpdateEmployee(Employee employee)
        {
            db.Entry(employee).State = EntityState.Modified;
            db.SaveChanges();
            var departments = db.Departments;

            return(PartialView("_PartialIndex", departments));
        }
示例#8
0
 public ActionResult Edit([Bind(Include = "DepartmentsId,DepartmentName")] Departments departments)
 {
     if (ModelState.IsValid)
     {
         db.Entry(departments).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(departments));
 }
示例#9
0
 public ActionResult Edit([Bind(Include = "JobId,JobName,Salary")] Job job)
 {
     if (ModelState.IsValid)
     {
         db.Entry(job).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(job));
 }
示例#10
0
 public ActionResult UpdateEmployee(Employee employee)
 {
     if (employee == null)
     {
         return(HttpNotFound());
     }
     db.Entry(employee).State = EntityState.Modified;
     db.SaveChanges();
     return(RedirectToAction("Index", "Department"));
 }
示例#11
0
 public ActionResult Edit([Bind(Include = "PersonId,Name,BeginDate,Grad,sex,Tecnology,Prim")] Person person)
 {
     if (ModelState.IsValid)
     {
         db.Entry(person).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(person));
 }
 public ActionResult Edit([Bind(Include = "Id,EmpName,Designation,DepartmentId")] Employee employee)
 {
     if (ModelState.IsValid)
     {
         db.Entry(employee).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.DepartmentId = new SelectList(db.Departments, "Id", "DepartmentName", employee.DepartmentId);
     return(View(employee));
 }
示例#13
0
        public async Task <IActionResult> PutMeetings(int id, Meeting meeting)
        {
            if (id != meeting.Id)
            {
                return(BadRequest());
            }

            db.Entry(meeting).State = EntityState.Modified;
            await db.SaveChangesAsync();

            return(NoContent());
        }
示例#14
0
        public async Task <IActionResult> PutEmployees(int id, Employee employee)
        {
            if (id != employee.Id)
            {
                return(BadRequest());
            }

            db.Entry(employee).State = EntityState.Modified;
            await db.SaveChangesAsync();

            return(NoContent());
        }
示例#15
0
 public ActionResult Edit(int id, EmployeeModel emp)
 {
     try
     {
         // TODO: Add update logic here
         DbContext.Entry(emp).State = System.Data.Entity.EntityState.Modified;
         DbContext.SaveChanges();
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
示例#16
0
        public async Task <bool> Put(int Id, Employee department)
        {
            _context.Entry(department).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                return(false);
            }
            return(true);
        }
示例#17
0
 public bool Update(Department entity)
 {
     try
     {
         context.Entry(entity).State = EntityState.Modified;
         int result = context.SaveChanges();
         if (result > 0)
         {
             return(true);
         }
         return(false);
     }
     catch (Exception ex)
     {
         //log
         throw ex;
     }
 }
示例#18
0
 public void Update(Employee t)
 {
     context.Entry <Employee>(t).State = EntityState.Modified;
 }
示例#19
0
 public void Update(Computer t)
 {
     context.Entry <Computer>(t).State = EntityState.Modified;
 }
示例#20
0
 public void Update(Organization t)
 {
     context.Entry <Organization>(t).State = EntityState.Modified;
 }