Exemplo n.º 1
0
        public async Task <bool> CreateActivity(int id, ActivityCreateViewModel activityCreateViewModel)
        {
            ActivityEntity activityEntity = new ActivityEntity
            {
                Society     = id,
                Name        = activityCreateViewModel.Name,
                Description = activityCreateViewModel.Description,
                Time        = activityCreateViewModel.Time,
                CreateTime  = DateTime.Now,
                Status      = ActivityDbSetStatusEnum.Pending.ToString()
            };

            _societyManagementSystemDbContext.Activity.Add(activityEntity);

            return(await _societyManagementSystemDbContext.SaveChangesAsync() != 0);
        }
Exemplo n.º 2
0
        public async Task <bool> EditStatusAsync(int id, MemberDbSetStatusEnum memberDbSetStatusEnum)
        {
            MemberEntity memberEntity = await _societyManagementSystemDbContext.Member.FindById(id);

            memberEntity.Status = memberDbSetStatusEnum.ToString();
            _societyManagementSystemDbContext.Member.Update(memberEntity);
            return(await _societyManagementSystemDbContext.SaveChangesAsync() != 0);
        }
Exemplo n.º 3
0
        public async Task <bool> JoinSociety(string user, int society, string entryPost)
        {
            if (await _societyManagementSystemDbContext.Member.FindByUserAndSocietyAsync(user, society) != null)
            {
                return(false);
            }

            MemberEntity memberEntity = new MemberEntity
            {
                User      = user,
                Society   = society,
                EntryPost = entryPost,
                EntryTime = DateTime.Now,
                Status    = MemberDbSetStatusEnum.Pending.ToString()
            };

            _societyManagementSystemDbContext.Member.Add(memberEntity);

            return(await _societyManagementSystemDbContext.SaveChangesAsync() != 0);
        }
Exemplo n.º 4
0
        public async Task <bool> TakePart(string user, int id)
        {
            if (await IsTakedPart(user, id))
            {
                return(false);
            }

            TakePartEntity takePartEntity = new TakePartEntity
            {
                User     = user,
                Activity = id,
                Time     = DateTime.Now
            };

            _societyManagementSystemDbContext.TakePart.Add(takePartEntity);

            return(await _societyManagementSystemDbContext.SaveChangesAsync() != 0);
        }