public async Task <ActionResult <CharityEntity> > PostCharityEntity(CharityEntity charityEntity)
        {
            _context.CharityEntity.Add(charityEntity);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetCharityEntity", new { id = charityEntity.Id }, charityEntity));
        }
        public async Task <IActionResult> PutCharityEntity(int id, CharityEntity charityEntity)
        {
            if (id != charityEntity.Id)
            {
                return(BadRequest());
            }

            _context.Entry(charityEntity).State = EntityState.Modified;

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

            return(NoContent());
        }
 private static StringBuilder SearchTermForCharity(CharityEntity charity)
 {
     if (charity.Keywords == null)
     {
         charity.Keywords = "";
     }
     var searchTerms = new StringBuilder();
     searchTerms.Append(charity.Name);
     foreach (var keyword in charity.Keywords.Split(','))
     {
         searchTerms.Append(" " + keyword);
     }
     return searchTerms;
 }
 public GuardianEnvelope SearchContentByCharityNameAndKeywords(CharityEntity charity)
 {
     var searchTerms = SearchTermForCharity(charity);
     return TryCustomSearchOrDefault(SearchContentOnGuardian(searchTerms.ToString()));
 }