private bool IsAlreadyCommented(UserCommentsAPI userComment) { try { double test = db.UserComments .SingleOrDefault(x => x.AccomodationId == userComment.AccomodationId && x.ApplicationUserId == userComment.ApplicationUserId) .Rating; } catch { return false; } return true; }
private bool CheckUser(UserCommentsAPI userComment) { int userCounts = 0; try { userCounts = db.RoomAvailabilities .Count(x => x.UserId == userComment.ApplicationUserId && x.ArrivalDate < DateTime.Now && x.AccomodationId == userComment.AccomodationId&& x.IsPaid == true); } catch { return false; } if (userCounts == 1) { return true; } return false; }