public async Task <IActionResult> SimpleSearch(string Name = null) { try { List <Offer> resultOffer = null; if (!string.IsNullOrEmpty(Name)) { ViewData["name"] = Name; int id = await _peopleService.FindByNameAsync(Name); if (id > -1) { var result = await _offerService.FindAllByPeopleIdAsync(id); return(View(result)); } else { ViewBag.Message = ("Name not found."); resultOffer = ViewSearch(); return(View(resultOffer)); } } else { var result = await _offerService.FindAllByProductIdAsync(); return(View(result)); } } catch (Exception e) { return(RedirectToAction(nameof(Error), new { message = e.Message })); } }