Example #1
0
        /// <summary>
        /// Tip: override GenerateEditDetailsDeleteLinks and supply custom values for the 'param' parameter
        /// </summary>
        protected override AddressLayoutContentsCreateEditViewModel GetLayoutContentsViewModelForCreateEdit(Address item, string title1, string title2, string title3, int pageSize, int labelClassColumnCount, int parentId, string param)
        {
            var initialPersonSuggestion = GetInitialPersonSuggestion(item);
            var initialSuggestion       = item?.Barangay?.CreateSuggestion();
            var action = GetActionName();

            if (initialSuggestion == null)
            {
                var tmpItem = new Barangay();

                initialSuggestion = tmpItem.CreateSuggestion();
            }

            var contentsVm = new AddressLayoutContentsCreateEditViewModel(item, title1, title2, title3, pageSize, action, parentId: parentId)
            {
                GetAddressTypes           = GetAddressTypes,
                GetOwnerTypes             = GetOwnerTypes,
                InitialBarangaySuggestion = initialSuggestion,
                InitialStreetAddress      = item?.StreetAddress,
                InitialPersonSuggestion   = initialPersonSuggestion
            };

            if (!string.IsNullOrWhiteSpace(param))
            {
                contentsVm.HasParent = true;
            }

            return(contentsVm);
        }