예제 #1
0
        public IHttpActionResult PostEmployee_tab(Employee_tab employee_tab)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Employee_tab.Add(employee_tab);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (Employee_tabExists(employee_tab.employee_id))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = employee_tab.employee_id }, employee_tab));
        }
예제 #2
0
        public IHttpActionResult PutEmployee_tab(decimal id, Employee_tab employee_tab)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != employee_tab.employee_id)
            {
                return(BadRequest());
            }

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

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!Employee_tabExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
예제 #3
0
        public IHttpActionResult GetEmployee_tab(decimal id)
        {
            Employee_tab employee_tab = db.Employee_tab.Find(id);

            if (employee_tab == null)
            {
                return(NotFound());
            }

            return(Ok(employee_tab));
        }
예제 #4
0
        public IHttpActionResult DeleteEmployee_tab(decimal id)
        {
            Employee_tab employee_tab = db.Employee_tab.Find(id);

            if (employee_tab == null)
            {
                return(NotFound());
            }

            db.Employee_tab.Remove(employee_tab);
            db.SaveChanges();

            return(Ok(employee_tab));
        }