Example #1
0
 public ActionResult DeleteUser(int id)
 {
     var request = new ApiRequest
     {
         EndPoint = $"delete/{id}",
     };
     request.Headers["Authentication-Token"] = Session["Authentication-Token"] as string;
     _webClientService.ExecuteDelete(request);
     return RedirectToAction("Manage");
 }
 public ActionResult Create(MatchViewModel model)
 {
     if (!ModelState.IsValid)
     {
         return View(model);
     }
     var request = new ApiRequest
     {
         EndPoint = "matches",
         Request = model
     };
     request.Headers["Authentication-Token"] = Session["Authentication-Token"] as string;
     _webClientService.ExecutePost<CreateMatchResponse>(request);
     return Manage();
 }
 public ActionResult CreatePrediction(PredictionViewModel model)
 {
     if (!ModelState.IsValid)
     {
         return View(model);
     }
     model.UserId = ((int?) Session["UserId"]).GetValueOrDefault();
     var request = new ApiRequest
     {
         EndPoint = $"matches/{model.MatchId}/predictions",
         Request = model
     };
     request.Headers["Authentication-Token"] = Session["Authentication-Token"] as string;
     _webClientService.ExecutePost<object>(request);
     return View("Index");
 }
        public ActionResult Edit(MatchViewModel model)
        {
            if (model.Winner.HasValue)
            {
                model.Status = MatchStatusesEnum.Finished;   
            }

            var request = new ApiRequest()
            {
                EndPoint = $"matches?id={model.Id}",
                Request = model
            };
            request.Headers["Authentication-Token"] = Session["Authentication-Token"] as string;
            var response = _webClientService.ExecutePut<ApiResponse<object>>(request);
            return Manage();
        }
 public ActionResult Cancel(int id)
 {
     var request = new ApiRequest
     {
         EndPoint = $"matches/{id}/status",
         Request = (int)MatchStatusesEnum.Canceled
         
     };
     request.Headers["Authentication-Token"] = Session["Authentication-Token"] as string;
     _webClientService.ExecutePut<object>(request);
     return Manage();
 }