public Opportunity GetOpportunity(IImageManager imageManager) { string imageUrl = ImageFile == null ? "images\\assets\\Untitled.png" : imageManager.UploadOpportunityImageAsync( ImageFile, ImageFilenameProducer.Create() ).Result; return(new Opportunity { Name = Name, Description = Description, Address = Address, CategoryId = CategoryId, ExternalSignUpUrl = ExternalSignUpUrl, Location = GoogleLocator.GetLocationFromAddress(Address), OpportunityType = OpportunityType, ContactEmail = ContactEmail, ImageUrl = imageUrl }); }
public Opportunity GetOpportunity(ApplicationDbContext context, IImageManager imageManager) { string imageUrl = ImageFile == null ? null : imageManager.UploadImageAsync(ImageFile, "opp" + Id + ImageFile.FileName).Result; Opportunity opportunity = context.Opportunities.Find(Id) ?? new Opportunity(); opportunity.Name = Name; opportunity.Description = Description; opportunity.Address = Address; if (imageUrl != null) { opportunity.ImageUrl = imageUrl; } opportunity.ExternalSignUpUrl = ExternalSignUpUrl; opportunity.Organization = context.Organizations.Find(OrganizationId); opportunity.Category = context.Categories.Find(CategoryId); opportunity.Community = context.Communities.Find(CommunityId); opportunity.Location = GoogleLocator.GetLocationFromAddress(Address); opportunity.OpportunityType = OpportunityType; return(opportunity); }
public Organization GetOrganization(ApplicationDbContext context, IImageManager imageManager) { string imageUrl = ImageFile == null ? null : imageManager.UploadImageAsync(ImageFile, "org" + Id + ImageFile.FileName).Result; Organization organization = context.Organizations.Find(Id) ?? new Organization(); organization.Id = Id; organization.Name = Name; organization.ContactEmail = ContactEmail; organization.PhoneNumber = PhoneNumber; organization.Address = Address; organization.WebsiteLink = WebsiteLink; organization.MissionStatement = MissionStatement; organization.FullDescription = FullDescription; organization.Cause = context.Causes.Find(CauseId); organization.Location = GoogleLocator.GetLocationFromAddress(Address); if (imageUrl != null) { organization.ImageUrl = imageUrl; } return(organization); }
public Opportunity GetOpportunity(ApplicationDbContext context, IImageManager imageManager) { string imageUrl = ImageFile == null ? null : imageManager.UploadOpportunityImageAsync( ImageFile, ImageFilenameProducer.Create() ).Result; var opportunity = context.Opportunities.Find(Id); opportunity.Name = Name; opportunity.Description = Description; opportunity.Address = Address; opportunity.CategoryId = CategoryId; if (imageUrl != null) { opportunity.ImageUrl = imageUrl; } opportunity.ExternalSignUpUrl = ExternalSignUpUrl; opportunity.Location = GoogleLocator.GetLocationFromAddress(Address); opportunity.ContactEmail = ContactEmail; opportunity.UpdatedDateTime = DateTime.Now; return(opportunity); }