Example #1
0
        public int Create(FranchiseeTenantParameter parameters)
        {
            var viewModel               = MapFromClientParameters(parameters);                                  //
            var franchiseeTenant        = viewModel.MapTo <FranchiseeTenant>();                                 //
            var franchiseeConfiguration = viewModel.MapTo <FranchiseeConfiguration>();                          //
            var sharViewModel           = viewModel.SharedViewModel as DashboardFranchiseeTenantShareViewModel; //
            var logoFilePath            = "";

            if (sharViewModel != null)
            {
                if (!String.IsNullOrEmpty(sharViewModel.Logo))
                {
                    if (!sharViewModel.Logo.Contains("data:image/jpg;base64"))
                    {
                        logoFilePath = Server.MapPath(sharViewModel.Logo);
                        franchiseeConfiguration.Logo = _resizeImage.ResizeImageByHeight(logoFilePath, 40);
                    }
                }
                else
                {
                    franchiseeConfiguration.Logo = Convert.FromBase64String("NULL");
                }

                if (String.IsNullOrEmpty(sharViewModel.Address2))
                {
                    franchiseeConfiguration.Address2 = "";
                }
                if (String.IsNullOrEmpty(sharViewModel.PrimaryContactFax))
                {
                    franchiseeConfiguration.PrimaryContactFax = "";
                }
                if (String.IsNullOrEmpty(sharViewModel.PrimaryContactEmail))
                {
                    franchiseeConfiguration.PrimaryContactEmail = "";
                }
                if (String.IsNullOrEmpty(sharViewModel.PrimaryContactCellNumber))
                {
                    franchiseeConfiguration.PrimaryContactCellNumber = "";
                }
            }
            var idInsert = _franchiseeTenantService.SetupFranchisee(franchiseeTenant, franchiseeConfiguration);//

            return(idInsert);
        }