コード例 #1
0
        public async Task <IHttpActionResult> PutRETRIVAL(string id, RETRIVAL rETRIVAL)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != rETRIVAL.RetrivalCode)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #2
0
        public async Task <IHttpActionResult> PostRETRIVAL(RETRIVAL rETRIVAL)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.RETRIVAL.Add(rETRIVAL);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (RETRIVALExists(rETRIVAL.RetrivalCode))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = rETRIVAL.RetrivalCode }, rETRIVAL));
        }
コード例 #3
0
        public RETRIVAL FindRetrival(string retrivalCode)
        {
            object[] paremeter =
            {
                new SqlParameter("@RetrivalCode", retrivalCode)
            };
            RETRIVAL res = db.Database.SqlQuery <RETRIVAL>("sp_GetRetrival @RetrivalCode", paremeter).FirstOrDefault();

            return(res);
        }
コード例 #4
0
 public ActionResult ViewDetail_Retrival()
 {
     RETRIVAL list = new RETRIVAL();
     HttpClient client = new AccessAPI().Access();
     HttpResponseMessage response = client.GetAsync(string.Format("api/RETRIVAL/FindRetrival?RetrivalCode={0}", Request.QueryString["Retrivalcode"])).Result;
     if (response.IsSuccessStatusCode)
     {
         list = response.Content.ReadAsAsync<RETRIVAL>().Result;
     }
     return View(list);
 }
コード例 #5
0
        public async Task <IHttpActionResult> DeleteRETRIVAL(string id)
        {
            RETRIVAL rETRIVAL = await db.RETRIVAL.FindAsync(id);

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

            db.RETRIVAL.Remove(rETRIVAL);
            await db.SaveChangesAsync();

            return(Ok(rETRIVAL));
        }