// 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)); }
// 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)); }
public ActionResult Create([Bind(Include = "idCompany,CompanyName,CompanyAddress,City,State,ZipCode,Country,Phone,idDepartment,idPosition")] Company company) { if (ModelState.IsValid) { db.Companies.Add(company); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(company)); }
public ActionResult Create([Bind(Include = "idUser_,Name,Paternal,Email,UserName,Password,DateCreate,isAdmin")] Recruitment recruitment) { if (ModelState.IsValid) { db.Recruitments.Add(recruitment); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(recruitment)); }
public ActionResult Create([Bind(Include = "idPosition,PositionName,PositionDescription,idCompany,DateCreate,Status,City,State,Country,idUser,IdUser")] Position position) { if (ModelState.IsValid) { db.Positions.Add(position); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.idCompany = new SelectList(db.Companies, "idCompany", "CompanyName", position.idCompany); return(View(position)); }
public ActionResult Create([Bind(Include = "idMessage,Subject,Message1,IdSendBy,IdEmployee,DateSend")] Message message) { if (ModelState.IsValid) { db.Messages.Add(message); 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 Create([Bind(Include = "IdEmployee,Name,LastName,Email,Birthday,Sex,Address,City,State,ZipCode,Country,HomePhone,CellPhone,idCompany,idUser,idPosition, IdUser")] Employee employee) { if (ModelState.IsValid) { db.Employees.Add(employee); 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); ViewBag.idPosition = new SelectList(db.Positions, "idPosition", "PositionName", employee.idPosition); return(View(employee)); }
public ActionResult Create(EmployeeModel employee) { if (!ModelState.IsValid) { return(Create()); } Employee dbEmployee = new Employee() { 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.Employees.Add(dbEmployee); db.SaveChanges(); } // перенаправляем на главную страницу return(RedirectToAction("Index")); }
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 Delete(int?id) { HumanResourceEntities dbcon = new HumanResourceEntities(); Employee idEmployee = dbcon.Employees.Find(id); dbcon.Employees.Remove(idEmployee); dbcon.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Delete(int?id) { HumanResourceEntities dbcon = new HumanResourceEntities(); Position idPosition = dbcon.Positions.Find(id); dbcon.Positions.Remove(idPosition); dbcon.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Delete(int?id) { HumanResourceEntities dbcon = new HumanResourceEntities(); Company idCompany = dbcon.Companies.Find(id); dbcon.Companies.Remove(idCompany); dbcon.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Delete(int?id) { HumanResourceEntities dbcon = new HumanResourceEntities(); Recruitment idRecruiter = dbcon.Recruitments.Find(id); dbcon.Recruitments.Remove(idRecruiter); dbcon.SaveChanges(); return(RedirectToAction("Index")); }
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")); } }