Example #1
0
        public IHttpActionResult PostKM_file(KM_file kM_file)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            kM_file.FlowId = Guid.NewGuid();
            db.KM_file.Add(kM_file);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (KM_fileExists(kM_file.FlowId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = kM_file.FlowId }, kM_file));
        }
Example #2
0
        public IHttpActionResult PutKM_file(Guid id, KM_file kM_file)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != kM_file.FlowId)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Example #3
0
        public IHttpActionResult GetKM_file(Guid id)
        {
            KM_file kM_file = db.KM_file.Find(id);

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

            return(Ok(kM_file));
        }
Example #4
0
        public IHttpActionResult DeleteKM_file(Guid id)
        {
            KM_file kM_file = db.KM_file.Find(id);

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

            db.KM_file.Remove(kM_file);
            db.SaveChanges();

            return(Ok(kM_file));
        }