예제 #1
0
        public IHttpActionResult Put(int id, t_ListForPrint t_ListForPrint)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != t_ListForPrint.ListId)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
예제 #2
0
        public t_ListForPrint Get()
        {
#if DEBUG
            Debug.WriteLine("Gett_ListForPrint");
#endif
            t_ListForPrint message = db.t_ListForPrint.FirstOrDefault();
            if (message == null)
            {
                message        = new t_ListForPrint();
                message.ListId = 0;
            }
            return(message);
        }
예제 #3
0
        public IHttpActionResult Post(t_ListForPrint t_ListForPrint)
        {
#if DEBUG
            Debug.WriteLine("Postt_ListForPrint");
#endif
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
#if DEBUG
            //Debug.WriteLine(String.Format("MessageId={0}"),t_ListForPrint.MessageId.ToString());
#endif
            db.t_ListForPrint.Add(t_ListForPrint);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = t_ListForPrint.ListId }, t_ListForPrint));
        }