// PUT api/Account/5 public IHttpActionResult PutDSTK(int id, DSTK dstk) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != dstk.ID) { return(BadRequest()); } db.Entry(dstk).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!DSTKExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
// PUT api/HumanResource/5 public IHttpActionResult PutTTNV(string id, TTNV ttnv) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != ttnv.ID) { return(BadRequest()); } db.Entry(ttnv).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!TTNVExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult Edit(int?id, EmployeeModel employee) { if (!ModelState.IsValid) { LoadDropDowns(id); return(View(employee)); } Employee dbEmployee = new Employee() { Id = employee.Id, Name = employee.Name, Surname = employee.Surname, Patronymic = employee.Patronymic, CityId = employee.CityId, StartDate = employee.StartDate, EndDate = employee.EndDate, MobilePhone = employee.MobilePhone, DateOfBirth = employee.DateOfBirth, Position = employee.Position, Phone = employee.Phone, Address = employee.Address, ManagerId = employee.ManagerId }; using (HumanResourceEntities db = new HumanResourceEntities()) { db.Entry(dbEmployee).State = EntityState.Modified; db.SaveChanges(); } // перенаправляем на главную страницу return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "idCompany,CompanyName,CompanyAddress,City,State,ZipCode,Country,Phone,idDepartment,idPosition")] Company company) { if (ModelState.IsValid) { db.Entry(company).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(company)); }
public ActionResult Edit([Bind(Include = "idUser_,Name,Paternal,Email,UserName,Password,DateCreate,isAdmin")] Recruitment recruitment) { if (ModelState.IsValid) { db.Entry(recruitment).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(recruitment)); }
public ActionResult Edit([Bind(Include = "idPosition,PositionName,PositionDescription,idCompany,DateCreate,Status,City,State,Country,idUser")] Position position) { if (ModelState.IsValid) { db.Entry(position).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.idCompany = new SelectList(db.Companies, "idCompany", "CompanyName", position.idCompany); return(View(position)); }
public ActionResult Edit([Bind(Include = "IdEmployee,Name,LastName,Email,Birthday,Sex,Address,City,State,ZipCode,Country,HomePhone,CellPhone,idCompany,idUser,idPosition")] Employee employee) { if (ModelState.IsValid) { db.Entry(employee).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.idCompany = new SelectList(db.Companies, "idCompany", "CompanyName", employee.idCompany); ViewBag.idUser = new SelectList(db.Recruitments, "idUser_", "Name", employee.idUser); return(View(employee)); }
public ActionResult Edit([Bind(Include = "idMessage,Subject,Message1,IdSendBy,IdEmployee,DateSend")] Message message) { if (ModelState.IsValid) { db.Entry(message).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.IdEmployee = new SelectList(db.Employees, "IdEmployee", "Name", message.IdEmployee); ViewBag.IdSendBy = new SelectList(db.Recruitments, "idUser_", "Name", message.IdSendBy); return(View(message)); }
public ActionResult Delete(int?id) { if (id == null) { return(HttpNotFound()); } using (HumanResourceEntities db = new HumanResourceEntities()) { Employee employee = new Employee { Id = id.Value }; db.Entry(employee).State = EntityState.Deleted; db.SaveChanges(); // перенаправляем на главную страницу return(RedirectToAction("Index")); } }