public async Task <IActionResult> Comment(YorumViewModel vm) { var temp = vm.UserName; if (!ModelState.IsValid) { return(RedirectToAction("mekan", temp, new { id = vm.mekanId })); } var mekan = _depo.MekanGetir(vm.mekanId); if (vm.MainCommentId == 0) { mekan.MainComments = mekan.MainComments ?? new List <MainComment>(); mekan.MainComments.Add(new MainComment { Message = vm.Message, Created = DateTime.Now, UserName = _userManager.GetUserName(User), }); _depo.YorumEkle(mekan); } else { var comment = new SubComment { MainCommentId = vm.MainCommentId, Message = vm.Message, Created = DateTime.Now, UserName = _userManager.GetUserName(User), }; _depo.AltYorumEkle(comment); } await _depo.SaveChangesAsync(); return(RedirectToAction("mekan", temp, new { id = vm.mekanId })); }