public PartialViewResult EditTravelLineItem(GrantAllocationAwardTravelLineItemPrimaryKey grantAllocationAwardTravelLineItemPrimaryKey)
        {
            var travelLineItem = grantAllocationAwardTravelLineItemPrimaryKey.EntityObject;
            var viewModel      = new EditGrantAllocationAwardTravelLineItemViewModel(travelLineItem);

            return(GrantAllocationAwardTravelLineItemViewEdit(viewModel));
        }
        private PartialViewResult GrantAllocationAwardTravelLineItemViewEdit(EditGrantAllocationAwardTravelLineItemViewModel viewModel)
        {
            var travelTypes = GrantAllocationAwardTravelLineItemType.All;
            var peopleList  = HttpRequestStorage.DatabaseEntities.People.ToList().OrderBy(x => x.FullNameLastFirst);
            var viewData    = new EditGrantAllocationAwardTravelLineItemViewData(travelTypes, peopleList);

            return(RazorPartialView <EditGrantAllocationAwardTravelLineItem, EditGrantAllocationAwardTravelLineItemViewData, EditGrantAllocationAwardTravelLineItemViewModel>(viewData, viewModel));
        }
        public PartialViewResult NewTravelLineItemFromGrantAllocationAward(GrantAllocationAwardPrimaryKey grantAllocationAwardPrimaryKey)
        {
            var grantAllocationAward = grantAllocationAwardPrimaryKey.EntityObject;
            var viewModel            = new EditGrantAllocationAwardTravelLineItemViewModel()
            {
                GrantAllocationAwardID = grantAllocationAward.GrantAllocationAwardID
            };

            return(GrantAllocationAwardTravelLineItemViewEdit(viewModel));
        }
        public ActionResult EditTravelLineItem(GrantAllocationAwardTravelLineItemPrimaryKey grantAllocationAwardTravelLineItemPrimaryKey, EditGrantAllocationAwardTravelLineItemViewModel viewModel)
        {
            var travelLineItem = grantAllocationAwardTravelLineItemPrimaryKey.EntityObject;

            if (!ModelState.IsValid)
            {
                return(GrantAllocationAwardTravelLineItemViewEdit(viewModel));
            }
            viewModel.UpdateModel(travelLineItem);
            return(new ModalDialogFormJsonResult());
        }
        public ActionResult NewTravelLineItemFromGrantAllocationAward(GrantAllocationAwardPrimaryKey grantAllocationAwardPrimaryKey, EditGrantAllocationAwardTravelLineItemViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(GrantAllocationAwardTravelLineItemViewEdit(viewModel));
            }

            var grantAllocationAward = HttpRequestStorage.DatabaseEntities.GrantAllocationAwards.Single(ga => ga.GrantAllocationAwardID == viewModel.GrantAllocationAwardID);
            var travelLineItem       = GrantAllocationAwardTravelLineItem.CreateNewBlank(grantAllocationAward, GrantAllocationAwardTravelLineItemType.Transportation);

            viewModel.UpdateModel(travelLineItem);
            return(new ModalDialogFormJsonResult());
        }