public IHttpActionResult AdvertisementDetail(string id)
        {
            try
            {
                var advertiser = repo.FindById(id);
                currentAccount = advertiser;

                return Ok<Advertisement>(advertiser);
            }
            catch (Exception)
            {
                return InternalServerError();
            }
        }
        public void Update(string id, Advertisement entity)
        {
            _context.Entry(entity);

            var original = _context.Advertisements.Find(id);

            if (original != null)
            {
                original.CompanyName = entity.CompanyName;
                original.Path = entity.Path;
                original.IsActive = entity.IsActive;
                original.ContactNumber = entity.ContactNumber;
                original.ContactPerson = entity.ContactPerson;
                original.CurrentDonation = entity.CurrentDonation;

            }
            _context.SaveChanges();
        }
 public void Create(Advertisement entity)
 {
     entity.AdvertisementId = Guid.NewGuid().ToString();
     _context.Advertisements.Add(entity);
     _context.SaveChanges();
 }
        public IHttpActionResult Publish(Advertisement image)
        {
            try
            {
                var advertisement = repo.FindById(image.AdvertisementId);

                if (advertisement.IsPublish)
                {
                    advertisement.IsPublish = false;
                }
                else
                {
                    advertisement.IsPublish = true;
                }

                repo.Update(advertisement.AdvertisementId, advertisement);

                return Ok<Advertisement>(advertisement);
            }
            catch (Exception)
            {

                return InternalServerError();
            }
        }
        public IHttpActionResult Create(Advertisement advertisement)
        {
            if (advertisement == null)
            {
                return NotFound();
            }

            if (!ModelState.IsValid)
            {
                return NotFound();
            }
            try
            {
                advertisement.AdvertisementId = Guid.NewGuid().ToString();
                repo.Create(advertisement);
                return Ok();
            }
            catch (Exception)
            {
                return InternalServerError();
            }
        }