Esempio n. 1
0
        public async Task <ActionResult> Update(int ID)
        {
            SetSessionVariables();

            PackageMasterResponse packageMasters = null;

            ServiceResult <PackageMasterResponse> result = null;

            PackageMasterUpdateViewModel packageMasterUpdateViewModel = null;

            try
            {
                using (HttpClient client = new HttpClient())
                {
                    client.BaseAddress = new Uri(Common.Instance.ApiPackageMasterControllerName);
                    var responseTask = await client.GetAsync(Common.Instance.ApiPackageMasterGet + "/" + ID);

                    result = await responseTask.Content.ReadAsAsync <ServiceResult <PackageMasterResponse> >();

                    packageMasters = result.Result;

                    packageMasterUpdateViewModel = new PackageMasterUpdateViewModel();
                    packageMasterUpdateViewModel.SetViewModel(packageMasters);
                }
            }
            catch (Exception ex)
            {
                ModelState.AddModelError(string.Empty, "Server error. Please contact administrator.");
            }
            return(View(packageMasterUpdateViewModel));
        }
 public void SetViewModel(PackageMasterResponse packageMasterResponse)
 {
     this.ID = packageMasterResponse.PackageMasterID;
     this.SeatReductionID    = packageMasterResponse.SeatReductionID;
     this.SpaceReductionID   = packageMasterResponse.SpaceReductionID;
     this.PackageName        = packageMasterResponse.PackageName;
     this.SeatReduction      = packageMasterResponse.SeatReduction;
     this.SeatReductionType  = packageMasterResponse.SeatReductionType;
     this.SpaceReduction     = packageMasterResponse.SpaceReduction;
     this.SpaceReductionType = packageMasterResponse.SpaceReductionType;
     this.IsActive           = packageMasterResponse.IsActive;
 }