public IActionResult AddPoints(int postId, int userId) { // this user should be the admin of the store User user = GetUser(); Post post = Context.Post.Include(o => o.Store).FirstOrDefault(o => o.Id == postId); // chack if the store is owned by the user who call the endpoint if (post.Store.User != user) { return(RedirectToAction("Index")); } //User to add the points User clientUser = Context.User.FirstOrDefault(o => o.Id == userId); StorePoints storePoints = StorePointsService.CreateStorePoints(clientUser, post.Store, post); StorePointsHistoryService.SaveStorePointsHistory(storePoints, post); return(RedirectToAction("Index")); }