Ejemplo n.º 1
0
        public IHttpActionResult Puttbl_Target(string id, tbl_Target tbl_Target)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != tbl_Target.Target_ID)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 2
0
        public IHttpActionResult Posttbl_Target(tbl_Target tbl_Target)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.tbl_Target.Add(tbl_Target);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (tbl_TargetExists(tbl_Target.Target_ID))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = tbl_Target.Target_ID }, tbl_Target));
        }
Ejemplo n.º 3
0
        public IHttpActionResult Gettbl_Target(string id)
        {
            tbl_Target tbl_Target = db.tbl_Target.Find(id);

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

            return(Ok(tbl_Target));
        }
Ejemplo n.º 4
0
        public IHttpActionResult Deletetbl_Target(string id)
        {
            tbl_Target tbl_Target = db.tbl_Target.Find(id);

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

            db.tbl_Target.Remove(tbl_Target);
            db.SaveChanges();

            return(Ok(tbl_Target));
        }