示例#1
0
        public async Task <Message> CreateNewMessage(Message message)
        {
            _context.Message.Add(message);
            await _context.SaveChangesAsync();

            return(message);
        }
        public async Task <Invitation> CreateInvitation(Invitation newInvitation)
        {
            var newInvitationInserted = await _context.Invitation.AddAsync(newInvitation);

            await _context.SaveChangesAsync();

            return(newInvitationInserted.Entity);
        }
示例#3
0
        public async Task <PersonalNote> DeletePersonalNote(int PersonalNoteId)
        {
            var note = await _context.PersonalNote.FindAsync(PersonalNoteId);

            _context.PersonalNote.Remove(note);
            await _context.SaveChangesAsync();

            return(note);
        }
        public async Task <Post> SaveNewPost(Post post)
        {
            _context.Post.Add(post);
            await _context.SaveChangesAsync();

            return(post);
        }
        public async Task <Milestone> UpdateMilestoneToPassed(Milestone milestone)
        {
            var milestoneToUpdate = await _context.Milestone.FindAsync(milestone.IdMilestone);

            milestoneToUpdate.IsDone = true;
            milestoneToUpdate.Date   = DateTime.Today;
            _context.Milestone.Update(milestoneToUpdate);
            await _context.SaveChangesAsync();

            return(milestoneToUpdate);
        }
示例#6
0
        public async Task <User> UpdateProfileUser(User User)
        {
            var existingUser = await _context.User.FindAsync(User.IdUser);

            existingUser.FirstName = User.FirstName;
            existingUser.LastName  = User.LastName;
            existingUser.Email     = User.Email;
            _context.User.Update(existingUser);
            await _context.SaveChangesAsync();

            return(User);
        }
        public async Task <ProjectPromoter> CreateProjectPromoter(ProjectPromoter promoter)
        {
            var newPromoter = await _context.ProjectPromoter.AddAsync(promoter);

            await _context.SaveChangesAsync();

            return(newPromoter.Entity);
        }
示例#8
0
        public async Task <ProjectMembers> CreateNewProjectMember(ProjectMembers newMember)
        {
            var insertedNewMember = await _context.ProjectMembers.AddAsync(newMember);

            await _context.SaveChangesAsync();

            return(insertedNewMember.Entity);
        }
        public async Task <Project> SaveNewProject(Project project)
        {
            var newProject = await _context.Project.AddAsync(project);

            await _context.SaveChangesAsync();

            return(newProject.Entity);
        }
        public async Task <Models.Task> CreateNewTask(Models.Task newTask)
        {
            var newTaskInserted = await _context.Task.AddAsync(newTask);

            await _context.SaveChangesAsync();

            return(newTaskInserted.Entity);
        }
示例#11
0
        public async Task <Profile> UpdateUserProfile(Profile Profile)
        {
            var existingProfile = await _context.Profile.FindAsync(Profile.IdProfile);

            existingProfile.Phone       = Profile.Phone;
            existingProfile.Country     = Profile.Country;
            existingProfile.DateOfBirth = Profile.DateOfBirth;
            existingProfile.Major       = Profile.Major;
            existingProfile.Skills      = Profile.Skills;
            existingProfile.Experiences = Profile.Experiences;
            existingProfile.Semester    = Profile.Semester;
            _context.Profile.Update(existingProfile);
            await _context.SaveChangesAsync();

            return(Profile);
        }