// PUT api/test/5
        public HttpResponseMessage PutPersonel(int id, Personel personel)
        {
            if (!ModelState.IsValid)
            {
                return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
            }

            if (id != personel.PersonnelID)
            {
                return Request.CreateResponse(HttpStatusCode.BadRequest);
            }

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

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException ex)
            {
                return Request.CreateErrorResponse(HttpStatusCode.NotFound, ex);
            }

            return Request.CreateResponse(HttpStatusCode.OK);
        }
        public ActionResult Create(Personel personel)
        {
            if (ModelState.IsValid)
            {
                db.Personels.Add(personel);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.PositionID = new SelectList(db.Positions, "PositionID", "PositionName", personel.PositionID);
            return View(personel);
        }
 public ModelRepository()
 {
     Project = new Project();
     ProjectsList = new List<Project>();
     ProjectCategory = new ProjectCategory();
     ProjectCategoryList = new List<ProjectCategory>();
     Personel = new Personel();
     PersonelList = new List<Personel>();
     Position = new Position();
     PositionList = new List<Position>();
     Task = new Task();
     TaskList = new List<Task>();
     WorkDay = new WorkDay();
     WorkDayList = new List<WorkDay>();
 }
        // POST api/test
        public HttpResponseMessage PostPersonel(Personel personel)
        {
            if (ModelState.IsValid)
            {
                db.Personels.Add(personel);
                db.SaveChanges();

                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, personel);
                response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = personel.PersonnelID }));
                return response;
            }
            else
            {
                return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
            }
        }
 public ActionResult Edit(Personel personel)
 {
     if (ModelState.IsValid)
     {
         db.Entry(personel).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.PositionID = new SelectList(db.Positions, "PositionID", "PositionName", personel.PositionID);
     return View(personel);
 }