public IActionResult Update(int id) { var token = HttpContext.Session.GetString("agentId"); if (string.IsNullOrEmpty(token)) { return(RedirectToAction("Index", "Login")); } var entity = _advertisementService.GetAdvertisementByExpression(x => x.Id == id); var model = _mapper.Map <AdvertisementModel>(entity); return(View(model)); }