예제 #1
0
 public async Task <string> ToggleLike(VideoViewModel video)
 {
     using (IVideoService videoService = ServiceCreator.CreateVideoService(Connection))
     {
         if (video.Liked)
         {
             await videoService.AddLike(video.Id, User.Identity.Name);
         }
         else
         {
             await videoService.DeleteLike(video.Id, User.Identity.Name);
         }
         int likesCount = videoService.GetVideo(video.Id).UsersLiked.Count();
         return("<p style=\"font-size:26px;\">" + likesCount + "</p>");
     }
 }