public async Task <IHttpActionResult> UnFollow(int UnFollowUser_Id) { try { var userId = Convert.ToInt32(User.GetClaimValue("userid")); using (RiscoContext ctx = new RiscoContext()) { FollowFollower followFollower = ctx.FollowFollowers.FirstOrDefault(x => x.FirstUser_Id == userId && x.SecondUser_Id == UnFollowUser_Id && x.IsDeleted == false); followFollower.IsDeleted = true; ctx.SaveChanges(); CustomResponse <FollowFollower> response = new CustomResponse <FollowFollower> { Message = Global.ResponseMessages.Success, StatusCode = (int)HttpStatusCode.OK, Result = followFollower }; return(Ok(response)); } } catch (Exception ex) { return(StatusCode(Utility.LogError(ex))); } }
public async Task <IHttpActionResult> Follow(int FollowUser_Id) { try { var userId = Convert.ToInt32(User.GetClaimValue("userid")); using (RiscoContext ctx = new RiscoContext()) { FollowFollower followFollower = new FollowFollower { FirstUser_Id = userId, SecondUser_Id = FollowUser_Id, CreatedDate = DateTime.UtcNow, }; ctx.FollowFollowers.Add(followFollower); ctx.SaveChanges(); CustomResponse <FollowFollower> response = new CustomResponse <FollowFollower> { Message = Global.ResponseMessages.Success, StatusCode = (int)HttpStatusCode.OK, Result = followFollower }; return(Ok(response)); } } catch (Exception ex) { return(StatusCode(Utility.LogError(ex))); } }