Ejemplo n.º 1
0
        public IHttpActionResult PutEmployee(int id, Employee employee)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EmployeeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
 public ActionResult Edit([Bind(Include = "ID,Name,JoiningDate,Age")] Employee employee)
 {
     if (ModelState.IsValid)
     {
         db.Entry(employee).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(employee));
 }
Ejemplo n.º 3
0
 public ActionResult Edit([Bind(Include = "Id,Name,CreatedOn,Age")] Client client)
 {
     if (ModelState.IsValid)
     {
         db.Entry(client).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(client));
 }
Ejemplo n.º 4
0
 public ActionResult Edit([Bind(Include = "ID,nombre,FechaAlta,edad")] Clientes clientes)
 {
     if (ModelState.IsValid)
     {
         db.Entry(clientes).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(clientes));
 }
Ejemplo n.º 5
0
        public ActionResult Edit(int id, Employee emptable)
        {
            try
            {
                // db.Employee.
                // db.Employee.(emptable);
                // db.Entry(countryVatMapping).State = EntityState.Modified;

                db.Entry(emptable).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
        public ActionResult Edit(int id, EmployeeSalaryModel collection)
        {
            try
            {
                db.Entry(collection).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();

                return(RedirectToAction("Index"));
            }
            catch
            {
                EmployeeSalary salarydata = db.EmployeeSalary.Where(m => m.Id == id).FirstOrDefault();

                EmployeeSalaryModel EmployeeSalarydata = new EmployeeSalaryModel();
                EmployeeSalarydata.Id                 = salarydata.Id;
                EmployeeSalarydata.EmpId              = salarydata.EmpId;
                EmployeeSalarydata.Salary             = salarydata.Salary;
                EmployeeSalarydata.EmployeeSelectList = employeeService.GetSelectListItems();
                return(View(EmployeeSalarydata));
            }
        }