예제 #1
0
        public async Task <Post> AddPost(Post post)
        {
            if (post == null)
            {
                return(null);
            }
            else
            {
                await _context.Posts.AddAsync(post);

                await _context.SaveChangesAsync();

                return(post);
            }
        }
예제 #2
0
        public async Task <Advertisement> AddAdvertisement(Advertisement advertisement)
        {
            // fluuent validation
            if (advertisement == null)
            {
                return(null);
            }
            else
            {
                await _context.Advertisements.AddAsync(advertisement);

                await _context.SaveChangesAsync();

                return(advertisement);
            }
        }
        public async Task <JobManagement> ApplytoJob(JobManagement appliance)
        {
            await _context.JobManagements.AddAsync(appliance);

            await _context.SaveChangesAsync();

            return(appliance);
        }
예제 #4
0
        public async Task <Models.Companies.Jobs.Job> AddJob(Models.Companies.Jobs.Job job)
        {
            if (job == null)
            {
                return(null);
            }
            else
            {
                job.JobId = Guid.NewGuid();

                await _context.Jobs.AddAsync(job);

                await _context.SaveChangesAsync();

                return(job);
            }
        }
예제 #5
0
        public async Task <User> EditUserProfile(User userEdited)
        {
            var user = await _context.Users.FindAsync(userEdited.CPF);

            if (user == null)
            {
                return(null);
            }
            else
            {
                user = userEdited;
                _context.Entry(user).State = EntityState.Modified;
                await _context.SaveChangesAsync();

                return(user);
            }
        }
예제 #6
0
        public async Task <bool> DeleteCompanyProfile(string id)
        {
            var user = await _context.Companies.FindAsync(id);

            if (user == null)
            {
                return(false);
            }
            else
            {
                _context.Companies.Remove(user);
                //_context.Entry(user).State = EntityState.Deleted;
                await _context.SaveChangesAsync();

                return(true);
            }
        }
예제 #7
0
        public async Task <Event> AddEvent(Event evento)
        {
            // fluent validation
            if (evento == null)
            {
                return(null);
            }
            else
            {
                evento.Id = Guid.NewGuid();

                await _context.Events.AddAsync(evento);

                await _context.SaveChangesAsync();

                return(evento);
            }
        }
예제 #8
0
        public async Task <Requirement> AddRequirement(Requirement requirement)
        {
            // fluent validation
            if (requirement == null)
            {
                return(null);
            }
            else
            {
                requirement.Id = Guid.NewGuid();

                await _context.Requirements.AddAsync(requirement);

                await _context.SaveChangesAsync();

                return(requirement);
            }
        }
예제 #9
0
        public async Task <Differential> AddDifferential(Differential differential)
        {
            // fluent validation - jobId nao pode ser nulo
            if (differential == null)
            {
                return(null);
            }
            else
            {
                differential.Id = Guid.NewGuid();

                await _context.Differentials.AddAsync(differential);

                await _context.SaveChangesAsync();

                return(differential);
            }
        }
예제 #10
0
        public async Task <Experience> AddExperience(Experience experience)
        {
            // fluuent validation
            if (experience == null)
            {
                return(null);
            }
            else
            {
                experience.Id = Guid.NewGuid();

                await _context.Experiences.AddAsync(experience);

                await _context.SaveChangesAsync();

                return(experience);
            }
        }
예제 #11
0
        public async Task <Education> AddEducation(Education education)
        {
            // fluent validation
            if (education == null)
            {
                return(null);
            }
            else
            {
                education.Id = Guid.NewGuid();

                await _context.Education.AddAsync(education);

                await _context.SaveChangesAsync();

                return(education);
            }
        }
예제 #12
0
        public async Task <Skill> AddSkill(Skill skill)
        {
            // fluuent validation
            if (skill == null)
            {
                return(null);
            }
            else
            {
                skill.Id = Guid.NewGuid();

                await _context.Skills.AddAsync(skill);

                await _context.SaveChangesAsync();

                return(skill);
            }
        }
예제 #13
0
        public async Task <bool> SingingUp(User newUser)
        {
            // chamar validation fluent data aqui
            if (newUser == null)
            {
                return(false);
            }
            else
            {
                await _context.Users.AddAsync(newUser);

                await _context.SaveChangesAsync();

                return(true);
            }
        }
예제 #14
0
        public async Task <Resume> AddResume(Resume resume)
        {
            // fluent validation
            //Creating relation between user-resume and a guid id to identifier resume
            if (resume == null)
            {
                return(null);
            }
            else
            {
                resume.Id = Guid.NewGuid();

                await _context.Resumes.AddAsync(resume);

                await _context.SaveChangesAsync();

                return(resume);
            }
        }