コード例 #1
0
        public IHttpActionResult PostShares_Type(Shares_Type shares_Type)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Shares_Type.Add(shares_Type);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (Shares_TypeExists(shares_Type.ID))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = shares_Type.ID }, shares_Type));
        }
コード例 #2
0
        public IHttpActionResult PutShares_Type(string id, Shares_Type shares_Type)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != shares_Type.ID)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #3
0
        public IHttpActionResult GetShares_Type(string id)
        {
            Shares_Type shares_Type = db.Shares_Type.Find(id);

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

            return(Ok(shares_Type));
        }
コード例 #4
0
        public IHttpActionResult DeleteShares_Type(string id)
        {
            Shares_Type shares_Type = db.Shares_Type.Find(id);

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

            db.Shares_Type.Remove(shares_Type);
            db.SaveChanges();

            return(Ok(shares_Type));
        }