Exemplo n.º 1
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));
        }
        // 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.º 3
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.º 4
0
 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));
 }
Exemplo n.º 5
0
 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));
 }
Exemplo n.º 6
0
 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));
 }
Exemplo n.º 7
0
 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));
 }
Exemplo n.º 8
0
 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));
 }
Exemplo n.º 9
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"));
            }
        }