コード例 #1
0
        public async Task <IActionResult> YorumSil(int id)
        {
            // Giriş yapan kullanıcı alınır.
            var user = await _userManager.GetUserAsync(HttpContext.User);

            try
            {
                // ilgili post giriş yapan kullanıcıya mı ait?
                if (depo.YorumGetir(id).UserName == user.UserName)
                {
                    depo.YorumSil(id);
                }
                else
                {
                    return(NotFound("404 Sayfa Bulunamadı"));
                }
            }
            catch (Exception)
            {
                return(NotFound("404 Sayfa Bulunamadı"));
            }
            return(RedirectToAction("mekan", username2, new { id = mekanid }));
        }