示例#1
0
        //[HttpPut, ActionName("EditTicker")]
        public HttpResponseMessage PutTICKER_MESSAGE_TBL(int id, TICKER_MESSAGE_TBL ticker_message_tbl)
        {
            ticker_message_tbl.MODIFIED_ON = DateTime.Now;
            ticker_message_tbl.MODIFIED_BY = AdminUsername();

            //if (!ModelState.IsValid)
            //{
            //return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
            //}

            if (id != ticker_message_tbl.MSG_ID)
            {
                return Request.CreateResponse(HttpStatusCode.BadRequest);
            }

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

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException ex)
            {
                return Request.CreateErrorResponse(HttpStatusCode.NotFound, ex);
            }

            return Request.CreateResponse(HttpStatusCode.OK, DateTime.Now);
        }
示例#2
0
        public int PostTICKER_MESSAGE_TBL(TICKER_MESSAGE_TBL ticker_message_tbl)
        {
            ticker_message_tbl.ADDED_BY = AdminUsername();

            db.TICKER_MESSAGE_TBL.Add(ticker_message_tbl);
            db.SaveChanges();

            int newId = ticker_message_tbl.MSG_ID;
            return newId;
        }