// 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));
        }
Exemplo n.º 2
0
        // 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));
        }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 4
0
        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));
        }
Exemplo n.º 5
0
        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));
        }
Exemplo n.º 6
0
        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));
        }
Exemplo n.º 7
0
        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));
        }
Exemplo n.º 8
0
        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"));
        }
Exemplo n.º 9
0
        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"));
        }
Exemplo n.º 10
0
        public ActionResult Delete(int?id)
        {
            HumanResourceEntities dbcon = new HumanResourceEntities();
            Employee idEmployee         = dbcon.Employees.Find(id);

            dbcon.Employees.Remove(idEmployee);
            dbcon.SaveChanges();

            return(RedirectToAction("Index"));
        }
Exemplo n.º 11
0
        public ActionResult Delete(int?id)
        {
            HumanResourceEntities dbcon = new HumanResourceEntities();
            Position idPosition         = dbcon.Positions.Find(id);

            dbcon.Positions.Remove(idPosition);
            dbcon.SaveChanges();

            return(RedirectToAction("Index"));
        }
Exemplo n.º 12
0
        public ActionResult Delete(int?id)
        {
            HumanResourceEntities dbcon = new HumanResourceEntities();
            Company idCompany           = dbcon.Companies.Find(id);

            dbcon.Companies.Remove(idCompany);
            dbcon.SaveChanges();

            return(RedirectToAction("Index"));
        }
Exemplo n.º 13
0
        public ActionResult Delete(int?id)
        {
            HumanResourceEntities dbcon       = new HumanResourceEntities();
            Recruitment           idRecruiter = dbcon.Recruitments.Find(id);

            dbcon.Recruitments.Remove(idRecruiter);
            dbcon.SaveChanges();

            return(RedirectToAction("Index"));
        }
Exemplo n.º 14
0
        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"));
            }
        }