Example #1
0
        public async Task <IHttpActionResult> PostBillerService(BillerService billerService)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.BillerServices.Add(billerService);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (BillerServiceExists(billerService.BillerID))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = billerService.BillerID }, billerService));
        }
Example #2
0
        public async Task <IHttpActionResult> PutBillerService(Guid id, BillerService billerService)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != billerService.BillerID)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Example #3
0
        public async Task <IHttpActionResult> GetBillerService(Guid id)
        {
            BillerService billerService = await db.BillerServices.FindAsync(id);

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

            return(Ok(billerService));
        }
Example #4
0
        public async Task <IHttpActionResult> DeleteBillerService(Guid id)
        {
            BillerService billerService = await db.BillerServices.FindAsync(id);

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

            db.BillerServices.Remove(billerService);
            await db.SaveChangesAsync();

            return(Ok(billerService));
        }