//Project Creator creates a FundingPackage public FundingPackage CreateFundingPackage( CreateFundingPackageOptions fundOptions) { //Elegxos gia null options if (fundOptions == null) { return(null); } var projectId = project_.GetProjectById(fundOptions.ProjectId); if (projectId == null || string.IsNullOrEmpty(fundOptions.DescriptionGift) || fundOptions.Deposit <= 0) { return(null); } var fundingPackage = new FundingPackage() { FixedPackageAmount = fundOptions.FixedPackageAmount, Deposit = fundOptions.Deposit, DescriptionGift = fundOptions.DescriptionGift }; context_.Add(fundingPackage); context_.SaveChanges(); return(fundingPackage); }
public FundingPackage CreateFundingPackage(CreateFundingPackageOptions options) { if (options == null) { return null; } var project = projectService_.Search(new SearchProjectOptions { ProjectId = options.ProjectId }).SingleOrDefault(); if (project == null) { return null; } var fp = new FundingPackage() { Name = options.Name, Description = options.Description, Price = options.Price, }; project.FundingPackages.Add(fp); context_.Update(project); context_.Add(fp); if (context_.SaveChanges() > 0) { return fp; } return null; }
//Project Creator creates a FundingPackage public FundingPackage CreateFundingPackage( CreateFundingPackageOptions fundOptions) { //Elegxos gia null options if (fundOptions == null) { return(null); } if (fundOptions.FixedPackageAmount == 0m || string.IsNullOrEmpty(fundOptions.DescriptionGift)) { return(null); } var fundingPackage = new FundingPackage() { DescriptionGift = fundOptions.DescriptionGift }; context_.Add(fundingPackage); context_.SaveChanges(); return(fundingPackage); }
public FundingPackage CreateFundingPackage( [FromBody] CreateFundingPackageOptions options) { return(_fundingPackageService.CreateFundingPackage(options)); }