Exemple #1
0
        public IHttpActionResult PutEmployee(int id, Employee employee)
        {
            if (id != employee.EmployeeID)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
 public IHttpActionResult DeleteShift(int id)
 {
     if (id <= 0)
     {
         return(BadRequest("Not a valid id"));
     }
     using (var ctx = new sdirecttestdbEntities1())
     {
         var shift = ctx.ShiftMasters
                     .Where(s => s.ShiftId == id)
                     .FirstOrDefault();
         ctx.Entry(shift).State = System.Data.Entity.EntityState.Deleted;
         ctx.SaveChanges();
     }
     return(Ok());
 }