Exemplo n.º 1
0
 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();
 }
Exemplo n.º 2
0
        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();
        }