public int LikePost(int postID, int userID, string status) { GenericDataAccess <LIKE> dataAccessLike = new GenericDataAccess <LIKE>(); GenericDataAccess <NOTIFICATION> dataAccessNotification = new GenericDataAccess <NOTIFICATION>(); int result; int posterID = postDataAccess.GetProfileOwnerID(postID); var like = new LIKE() { LIKED_BY = userID, POST_ID = postID }; if (status == "like") { result = dataAccessLike.Create(like); if (result == 1 && userID != posterID) { NOTIFICATION notification = new NOTIFICATION() { NOTIF_TYPE = "L", POST_ID = postID, RECEIVER_ID = posterID, SENDER_ID = userID, CREATED_DATE = DateTime.Now, SEEN = "N" }; dataAccessNotification.Create(notification); } } else { result = dataAccessLike.Delete(likeDataAccess.GetLike(like)); if (result == 1 && userID != posterID) { dataAccessNotification.Delete(notificationDataAccess.GetNotificationForLike(like)); } } return(result); }