Пример #1
0
        // PUT api/PayItem/5
        public IHttpActionResult EditPayItem(PayItem payitem)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }
            payitem.LastUpdatedDate = DateTime.Now;
            db.Entry(payitem).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PayItemExists(payitem.RowID))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return StatusCode(HttpStatusCode.NoContent);
        }
Пример #2
0
        public IHttpActionResult PostPayItem(PayItem payitem)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }
            payitem.LastUpdatedDate = DateTime.Now;
            db.PayItem.Add(payitem);
            db.SaveChanges();

            return Ok(payitem);
        }