public IActionResult RegisterComment([FromBody] Comment comment) //Xóa comment truyền vào body model comment { string err = ""; try{ var identity = HttpContext.User.Identity as ClaimsIdentity; //khai báo biến danh tính của token IList <Claim> claim = identity.Claims.ToList(); //Danh sách các biến trong identity string Email = claim[1].Value; //Email của token User userinfo = new User(); //Khai bao biến thông tin người dùng if (userinfo.kiemtrathoigianlogin(DateTime.Parse(claim[0].Value)) == true) //kiểm tra thời gian đăng nhập còn không { Comment comment1 = new Comment(); //Khai báo biến model Comment string Idcomment = comment1.AddToFireBase(comment); //Thêm comment err = Idcomment; //Trả về IDcomment } else { return(Ok(new[] { "Bạn cần đăng nhập" })); } } catch { err = "Error"; } return(Ok(new[] { err })); }