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

                await _context.SaveChangesAsync();

                return(post);
            }
        }
Exemple #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);
        }
Exemple #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);
            }
        }
        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);
            }
        }
Exemple #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);
            }
        }
        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);
            }
        }
Exemple #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);
            }
        }
Exemple #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);
            }
        }
        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);
            }
        }
Exemple #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);
            }
        }
Exemple #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);
            }
        }
        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);
            }
        }
        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);
            }
        }