public PartialViewResult EditLandownerCostShareLineItem(GrantAllocationAwardLandownerCostShareLineItemPrimaryKey grantAllocationAwardLandownerCostShareLineItemPrimaryKey)
        {
            var landownerCostShareLineItem = grantAllocationAwardLandownerCostShareLineItemPrimaryKey.EntityObject;
            var viewModel = new EditGrantAllocationAwardLandownerCostShareLineItemViewModel(landownerCostShareLineItem);

            return(GrantAllocationAwardLandownerCostShareLineItemViewEdit(viewModel));
        }
        public PartialViewResult NewLandownerCostShareLineItemFromGrantAllocationAward(GrantAllocationAwardPrimaryKey grantAllocationAwardPrimaryKey)
        {
            var grantAllocationAward = grantAllocationAwardPrimaryKey.EntityObject;
            var viewModel            = new EditGrantAllocationAwardLandownerCostShareLineItemViewModel()
            {
                GrantAllocationAwardID = grantAllocationAward.GrantAllocationAwardID
            };

            return(GrantAllocationAwardLandownerCostShareLineItemViewEdit(viewModel));
        }
        public ActionResult EditLandownerCostShareLineItem(GrantAllocationAwardLandownerCostShareLineItemPrimaryKey grantAllocationAwardLandownerCostShareLineItemPrimaryKey, EditGrantAllocationAwardLandownerCostShareLineItemViewModel viewModel)
        {
            var landownerCostShareLineItem = grantAllocationAwardLandownerCostShareLineItemPrimaryKey.EntityObject;

            if (!ModelState.IsValid)
            {
                return(GrantAllocationAwardLandownerCostShareLineItemViewEdit(viewModel));
            }
            viewModel.UpdateModel(landownerCostShareLineItem);
            return(new ModalDialogFormJsonResult());
        }
        private PartialViewResult GrantAllocationAwardLandownerCostShareLineItemViewEdit(EditGrantAllocationAwardLandownerCostShareLineItemViewModel viewModel)
        {
            var statusList  = LandownerCostShareLineItemStatus.All;
            var projectList = HttpRequestStorage.DatabaseEntities.Projects.ToList().OrderBy(x => x.DisplayName);
            var grantAllocationAwardList = HttpRequestStorage.DatabaseEntities.GrantAllocationAwards.OrderBy(x => x.GrantAllocationAwardName);
            var viewData = new EditGrantAllocationAwardLandownerCostShareLineItemViewData(statusList, projectList, grantAllocationAwardList);

            return(RazorPartialView <EditGrantAllocationAwardLandownerCostShareLineItem, EditGrantAllocationAwardLandownerCostShareLineItemViewData, EditGrantAllocationAwardLandownerCostShareLineItemViewModel>(viewData, viewModel));
        }
        public ActionResult NewLandownerCostShareLineItemFromGrantAllocationAward(GrantAllocationAwardPrimaryKey grantAllocationAwardPrimaryKey, EditGrantAllocationAwardLandownerCostShareLineItemViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(GrantAllocationAwardLandownerCostShareLineItemViewEdit(viewModel));
            }

            var grantAllocationAward = HttpRequestStorage.DatabaseEntities.GrantAllocationAwards.Single(ga => ga.GrantAllocationAwardID == viewModel.GrantAllocationAwardID);
            var project = HttpRequestStorage.DatabaseEntities.Projects.Single(x => x.ProjectID == viewModel.ProjectID);
            var landownerCostShareLineItemStatus = LandownerCostShareLineItemStatus.All.Single(x => x.LandownerCostShareLineItemStatusID == viewModel.StatusID);
            var landownerCostShareLineItem       = GrantAllocationAwardLandownerCostShareLineItem.CreateNewBlank(project, landownerCostShareLineItemStatus);

            landownerCostShareLineItem.GrantAllocationAwardID = grantAllocationAward.GrantAllocationAwardID;
            viewModel.UpdateModel(landownerCostShareLineItem);
            return(new ModalDialogFormJsonResult());
        }