Request model for Get Hire Group Request
Exemplo n.º 1
0
 /// <summary>
 /// Hire Group Selection screen
 /// </summary>
 public ActionResult HireGroup(FormCollection collection)
 {
     if (collection["HireGroupDetailId"] != null)
     {
         var bookingView = new BookingViewModel
         {
             HireGroupDetailId = Convert.ToInt64(collection["HireGroupDetailId"]),
             OperationWorkPlaceId = Convert.ToInt64(collection["OperationWorkPlaceId"]),
             OperationWorkPlaceCode = Convert.ToString(collection["OperationWorkPlaceCode"]),
             StartDt = Convert.ToDateTime(collection["StartDateTime"]),
             EndDt = Convert.ToDateTime(collection["EndDateTime"]),
             TariffTypeCode = Convert.ToString(collection["TariffTypeCode"])
         };
         TempData["Booking"] = bookingView;
         return RedirectToAction("Services");
     }
     //hire group get
     var bookingViewModel = TempData["Booking"] as BookingViewModel;
     var hireGroupRequest = new GetHireGroupRequest();
     if (bookingViewModel != null)
     {
         hireGroupRequest.StartDateTime = bookingViewModel.StartDt;
         hireGroupRequest.EndDateTime = bookingViewModel.EndDt;
         hireGroupRequest.OutLocationId = bookingViewModel.OperationWorkPlaceId;
         hireGroupRequest.ReturnLocationId = bookingViewModel.OperationWorkPlaceId;
         hireGroupRequest.DomainKey = 1;
     }
     IEnumerable<HireGroupDetail> hireGroupDetails = webApiService.GetHireGroupList(hireGroupRequest)  .AvailableHireGroups.Select(x => x.CreateFrom());
     ViewBag.BookingVM = TempData["Booking"] as BookingViewModel;
     return View(hireGroupDetails.ToList());
 }
Exemplo n.º 2
0
        /// <summary>
        /// Get Available HireGroup
        /// </summary>
        private async Task<GetHireGroupResult> GetHireGroupAsync(GetHireGroupRequest request)
        {
            string requestContents = Newtonsoft.Json.JsonConvert.SerializeObject(request);
            HttpResponseMessage responseMessage = await PostHttpRequestAsync(requestContents, new Uri(GetHireGroupListUri)).ConfigureAwait(false);
            if (responseMessage.IsSuccessStatusCode)
            { 
                string stringContents = await responseMessage.Content.ReadAsStringAsync();
                return new GetHireGroupResult
                {
                    AvailableHireGroups = CreateResultForHireGroupsListRequest(stringContents)
                };

            }
            else
            {
                string errorString = await responseMessage.Content.ReadAsStringAsync();
                return new GetHireGroupResult
                {
                    Error = errorString
                };
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Get Hire Group List
 /// </summary>
 public GetHireGroupResult GetHireGroupList(GetHireGroupRequest request)
 {
     return GetHireGroupAsync(request).Result;
 }