public IEnumerable <ExtraAddonResponseDTO> Execute(ExtraAddonSearchName request) { var query = AiContext.ExtraAddons.AsQueryable().Where(x => x.IsDeleted == 0); var keyword = request.Keyword; if (keyword != null) { query = query .Where(x => x.Name.ToLower().Contains(keyword.ToLower())); } return(query .Select(x => new ExtraAddonResponseDTO { Id = x.Id, Name = x.Name, Price = x.Price })); }
public ActionResult <IEnumerable <ExtraAddonResponseDTO> > Get([FromQuery] ExtraAddonSearchName name) { var extras = _getExtras.Execute(name); return(Ok(extras)); }