Exemple #1
0
        public Photo CreatePhoto(CreatePhotoOptions options)
        {
            if (options == null)
            {
                return(null);
            }

            var project = projectService_.Search(new SearchProjectOptions
            {
                ProjectId = options.ProjectId
            }).SingleOrDefault();

            if (project == null)
            {
                return(null);
            }

            var photo = new Photo()
            {
                Name = options.Name,
                Path = options.Path,
            };

            project.Photos.Add(photo);
            context_.Update(project);
            context_.Add(photo);

            if (context_.SaveChanges() > 0)
            {
                return(photo);
            }

            return(null);
        }
Exemple #2
0
        public Status CreateStatus(CreateStatusOptions options)
        {
            if (options == null)
            {
                return(null);
            }

            var project = projectService_.Search(new SearchProjectOptions
            {
                ProjectId = options.ProjectId
            }).SingleOrDefault();

            if (project == null)
            {
                return(null);
            }

            var status = new Status()
            {
                Description = options.Description
            };

            project.Status.Add(status);
            context_.Update(project);
            context_.Add(status);

            if (context_.SaveChanges() > 0)
            {
                return(status);
            }
            return(null);
        }
Exemple #3
0
        public Project Create(CreateProjectOptions options)
        {
            if (options == null)
            {
                return(null);
            }
            var project = new Project()
            {
                Title       = options.Title,
                Description = options.Description,
                TargetFund  = options.TargetFund,
                CurrentFund = options.CurrentFund
            };

            context_.Add(project);
            if (context_.SaveChanges() > 0)
            {
                return(project);
            }
            return(null);
        }
Exemple #4
0
        public ApplicationUser Create(CreateUserOptions options)
        {
            if (options == null)
            {
                return(null);
            }

            var user = new ApplicationUser()
            {
                FirstName   = options.FirstName,
                LastName    = options.LastName,
                UserName    = options.UserName,
                DateOfBirth = options.DateOfBirth
            };

            if (user != null)
            {
                context_.Add(user);
                context_.SaveChanges();
                return(user);
            }

            return(null);
        }
Exemple #5
0
 public void Add(FundingPackage fundingPackage)
 {
     context_.Add(fundingPackage);
     context_.SaveChanges();
 }
 public void Add(UserBacker userBacker)
 {
     context_.Add(userBacker);
     context_.SaveChanges();
 }