public IHttpActionResult PutBuyerLead(int id, BuyerLead buyerLead)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != buyerLead.BuyerLeadId)
            {
                return(BadRequest());
            }

            //db.Entry(buyerLead).State = EntityState.Modified;
            buyerCrud.Update(buyerLead);

            try
            {
                //db.SaveChanges();
                buyerCrud.Save();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!BuyerLeadExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public async Task <ActionResult> Delete(int id, BuyerLead buyerLeadToDelete)
        {
            HttpResponseMessage response = await httpClient.DeleteAsync("http://ec2-13-58-19-141.us-east-2.compute.amazonaws.com/realestateapi/api/BuyerLeads/" + id);

            if (!response.IsSuccessStatusCode)
            {
                return(View("Error"));
            }
            return(RedirectToAction("Index"));
        }
        public IHttpActionResult GetBuyerLead(int id)
        {
            BuyerLead buyerLead = buyerCrud.GetByID(id);

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

            return(Ok(buyerLead));
        }
        public IHttpActionResult PostBuyerLead(BuyerLead buyerLead)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            //db.BuyerLeads.Add(buyerLead);
            //db.SaveChanges();
            buyerCrud.Insert(buyerLead);

            return(CreatedAtRoute("DefaultApi", new { id = buyerLead.BuyerLeadId }, buyerLead));
        }