Exemplo n.º 1
0
        public IHttpActionResult PostItemWorkComplete(ItemWorkComplete itemWorkComplete)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.ItemWorkCompletes.Add(itemWorkComplete);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (ItemWorkCompleteExists(itemWorkComplete.ItemInstanceID))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = itemWorkComplete.ItemInstanceID }, itemWorkComplete));
        }
Exemplo n.º 2
0
        public IHttpActionResult PutItemWorkComplete(Guid id, ItemWorkComplete itemWorkComplete)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != itemWorkComplete.ItemInstanceID)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 3
0
        public IHttpActionResult GetItemWorkComplete(Guid id)
        {
            ItemWorkComplete itemWorkComplete = db.ItemWorkCompletes.Find(id);

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

            return(Ok(itemWorkComplete));
        }
Exemplo n.º 4
0
        public IHttpActionResult DeleteItemWorkComplete(Guid id)
        {
            ItemWorkComplete itemWorkComplete = db.ItemWorkCompletes.Find(id);

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

            db.ItemWorkCompletes.Remove(itemWorkComplete);
            db.SaveChanges();

            return(Ok(itemWorkComplete));
        }