private BusinessViewModel populateModel(BusinessListing listingModel) { var model = new BusinessViewModel(listingModel); //model.Listing = listingModel; switch (listingModel.BusinessType) { case BusinessType.Artists: model.FormData = formsRepo.GetByName("ArtistsCreate"); break; case BusinessType.HealthCare: model.FormData = formsRepo.GetByName("HealthCareCreate"); break; case BusinessType.AltHealthCare: model.FormData = formsRepo.GetByName("AltHealthCareCreate"); break; case BusinessType.Information: model.FormData = formsRepo.GetByName("InformationCreate"); break; case BusinessType.Instruction: model.FormData = formsRepo.GetByName("InstructionCreate"); break; case BusinessType.Lawyers: model.FormData = formsRepo.GetByName("LawyersCreate"); break; case BusinessType.Restaurant: model.FormData = formsRepo.GetByName("RestaurantCreate"); break; case BusinessType.ServiceProviders: model.FormData = formsRepo.GetByName("ServiceProvidersCreate"); break; case BusinessType.Shopkeepers: model.FormData = formsRepo.GetByName("ShopkeepersCreate"); break; case BusinessType.Support: model.FormData = formsRepo.GetByName("SupportCreate"); break; default: break; } model.Listing.Initialize(); return(model); }
public BusinessViewModel(BusinessListing listing) { this.Listing = listing; this.Id = listing.Id.ToString(); this.Type = listing.BusinessType.ToString(); this.TitleFormatted = DisplayHelper.ParseBusinessTitle(listing.Titles); this.ContactFormatted = DisplayHelper.ParseListingContact(listing.Contact); this.DescriptionFormatted = DisplayHelper.ParseListingDescription(listing.Descriptions); this.LocationFormatted = DisplayHelper.ParseListingLocation(listing.Location); this.Brag = listing.Brag; this.LongDescription = listing.LongDescription; this.BusinessType = listing.BusinessType.ToString(); }
public async Task <ActionResult <BusinessListing> > PutTodoItem(long id, BusinessListing model) { // var id = model.Id; var customerName = model.CustomerName; var emailAddress = model.Email; var businessName = model.BusinessName; var businessAddress = model.Address; var city = model.City; var lga = model.Lga; var url = model.Url; var businessDescription = model.Description; var categoryId = model.CategoryId; var categories = _context.Categories.Where(m => m.Id == categoryId); var businesslisting = _context.BusinessListing.FirstOrDefault(m => m.Id == id); if (model != null) { businesslisting.CustomerName = model.CustomerName; businesslisting.Email = model.Email; businesslisting.BusinessName = model.BusinessName; businesslisting.Address = model.Address; businesslisting.City = model.City; businesslisting.Lga = model.Lga; businesslisting.Url = model.Url; businesslisting.Description = model.Description; _context.Update(businesslisting); await _context.SaveChangesAsync(); } /* if (id != model.Id) * { * return BadRequest(); * }*/ // _context.Entry(model).State = EntityState.Modified; return(Ok()); }
private static List <BusinessListing> GetSeedBusinessListings() { var result = new List <BusinessListing>(); var bondHealthCare = new BusinessListing(); bondHealthCare.Titles.Add("Bond Physical Therapy"); bondHealthCare.Descriptions.Add("Physical Therapy"); bondHealthCare.Descriptions.Add("Bond"); bondHealthCare.Descriptions.Add("John P"); bondHealthCare.Descriptions.Add("DPT"); bondHealthCare.Descriptions.Add("general physical therapy"); bondHealthCare.Descriptions.Add("All PT needs"); bondHealthCare.Contact.Add("www.bondpt.com"); bondHealthCare.Contact.Add("777.777.7777, 724.944.1234"); bondHealthCare.Brag = "We are dedicated to excellence and you will get the best experience from us."; bondHealthCare.BusinessType = BusinessType.HealthCare; result.Add(bondHealthCare); return(result); }
public async Task <ActionResult <BusinessListing> > PostBusinessListing([FromBody] BusinessListing model) { var customerName = model.CustomerName; var emailAddress = model.Email; var businessName = model.BusinessName; var businessAddress = model.Address; var city = model.City; var lga = model.Lga; var url = model.Url; var businessDescription = model.Description; var categoryId = model.CategoryId; var categories = _context.Categories.Where(m => m.Id == categoryId); var businesslisting = _context.BusinessListing.Where(m => m.BusinessName == model.BusinessName).ToList(); if (businesslisting.Any() || !businesslisting.Any()) // if(!businesslisting.Any()) { var Businesslisting = new BusinessListing() { CustomerName = customerName, Email = emailAddress, BusinessName = businessName, Address = businessAddress, City = city, Lga = lga, Url = url, Description = businessDescription, CategoryId = categoryId }; _context.BusinessListing.Add(Businesslisting); await _context.SaveChangesAsync(); return(Ok()); } return(BadRequest()); }
public static List <BusinessSearchCategory> GetCategories(BusinessListing business) { var result = new List <BusinessSearchCategory>(); switch (business.BusinessType) { case BusinessType.Artists: result.Add(BusinessSearchCategory.Art); break; case BusinessType.HealthCare: result.Add(BusinessSearchCategory.Healthcare); break; case BusinessType.AltHealthCare: result.Add(BusinessSearchCategory.HealthcareAlt); break; case BusinessType.Information: result.Add(BusinessSearchCategory.SupportInformation); result.Add(BusinessSearchCategory.All); break; case BusinessType.Instruction: result.Add(BusinessSearchCategory.Lessons); break; case BusinessType.Lawyers: result.Add(BusinessSearchCategory.Lawyers); break; case BusinessType.Restaurant: result.Add(BusinessSearchCategory.FoodAndBeverage); break; case BusinessType.ServiceProviders: result.Add(BusinessSearchCategory.Services); break; case BusinessType.Shopkeepers: result.Add(BusinessSearchCategory.Retail); break; case BusinessType.Support: result.Add(BusinessSearchCategory.SupportInformation); result.Add(BusinessSearchCategory.All); break; case BusinessType.Other: result.Add(BusinessSearchCategory.All); result.Add(BusinessSearchCategory.All); break; default: break; } result.AddRange(getAdditionalCategories(DisplayHelper.ParseListingDescription(business.Descriptions))); result.AddRange(getAdditionalCategories(DisplayHelper.ParseBusinessTitle(business.Titles))); //result.AddRange(getAdditionalCategories(business.Descriptions[0])); //result.AddRange(getAdditionalCategories(business.Titles[0])); return(result); }
public BusinessViewModel(BusinessListing listing, BusinessFormData formData) : this(listing) { this.FormData = FormData; }