public IHttpActionResult PostCustomerpayment(Customerpayment customerpayment)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Customerpayments.Add(customerpayment);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (CustomerpaymentExists(customerpayment.PayId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = customerpayment.PayId }, customerpayment));
        }
        public IHttpActionResult PutCustomerpayment(int id, Customerpayment customerpayment)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != customerpayment.PayId)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public IHttpActionResult GetCustomerpayment(int id)
        {
            Customerpayment customerpayment = db.Customerpayments.Find(id);

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

            return(Ok(customerpayment));
        }
        public IHttpActionResult DeleteCustomerpayment(int id)
        {
            Customerpayment customerpayment = db.Customerpayments.Find(id);

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

            db.Customerpayments.Remove(customerpayment);
            db.SaveChanges();

            return(Ok(customerpayment));
        }