Example #1
0
        public IHttpActionResult Postvw_donationsummary(vw_donationsummary vw_donationsummary)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            db.vw_donationsummary.Add(vw_donationsummary);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (vw_donationsummaryExists(vw_donationsummary.OnBehalfOf))
                {
                    return Conflict();
                }
                else
                {
                    throw;
                }
            }

            return CreatedAtRoute("DefaultApi", new { id = vw_donationsummary.OnBehalfOf }, vw_donationsummary);
        }
Example #2
0
        // PUT api/Donations/5
        public IHttpActionResult Putvw_donationsummary(string id, vw_donationsummary vw_donationsummary)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != vw_donationsummary.OnBehalfOf)
            {
                return BadRequest();
            }

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

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

            return StatusCode(HttpStatusCode.NoContent);
        }