public async Task<IHttpActionResult> FollowOption(FollowOption option)
 {
     return await Task.Run(() =>
     {
         var userId = RequestContext.Principal.Identity.GetUserId();
         option.UserId = userId;
         var optionPO = _repositoryManager.FollowOptionRepository.Get(m => m.FollowTypeId == option.FollowTypeId && m.OptionId == option.OptionId && m.UserId == option.UserId);
         if (optionPO == null)
         {
             option.CreatedDate = DateTime.Now;
             _repositoryManager.FollowOptionRepository.Create(option);
         }
         else
         {
             _repositoryManager.FollowOptionRepository.Delete(optionPO);
         }
         _repositoryManager.FollowOptionRepository.Save();
         return Ok();
     });
 }
Beispiel #2
0
 public async Task <IHttpActionResult> FollowOption(FollowOption option)
 {
     return(await Task.Run(() =>
     {
         var userId = RequestContext.Principal.Identity.GetUserId();
         option.UserId = userId;
         var optionPO = _repositoryManager.FollowOptionRepository.Get(m => m.FollowTypeId == option.FollowTypeId && m.OptionId == option.OptionId && m.UserId == option.UserId);
         if (optionPO == null)
         {
             option.CreatedDate = DateTime.Now;
             _repositoryManager.FollowOptionRepository.Create(option);
         }
         else
         {
             _repositoryManager.FollowOptionRepository.Delete(optionPO);
         }
         _repositoryManager.FollowOptionRepository.Save();
         return Ok();
     }));
 }