Example #1
0
        public async Task <IHttpActionResult> PutFakeAccountInfo(int id, FakeAccountInfo fakeAccountInfo)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != fakeAccountInfo.InfoId)
            {
                return(BadRequest());
            }

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

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!FakeAccountInfoExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Example #2
0
        public async Task <IHttpActionResult> GetFakeAccountInfo(int id)
        {
            FakeAccountInfo fakeAccountInfo = await db.FakeAccountInfoes.FindAsync(id);

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

            return(Ok(fakeAccountInfo));
        }
Example #3
0
        public async Task <IHttpActionResult> PostFakeAccountInfo(FakeAccountInfo fakeAccountInfo)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.FakeAccountInfoes.Add(fakeAccountInfo);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = fakeAccountInfo.InfoId }, fakeAccountInfo));
        }
Example #4
0
        public async Task <IHttpActionResult> DeleteFakeAccountInfo(int id)
        {
            FakeAccountInfo fakeAccountInfo = await db.FakeAccountInfoes.FindAsync(id);

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

            db.FakeAccountInfoes.Remove(fakeAccountInfo);
            await db.SaveChangesAsync();

            return(Ok(fakeAccountInfo));
        }