Exemplo n.º 1
0
        public async Task <bool> SaveStatus(EventInvite invite)
        {
            _context.Entry(invite).State = EntityState.Modified;
            await _context.SaveChangesAsync();

            return(true);
        }
Exemplo n.º 2
0
        public async Task <string> DeleteAsync(long id, long userId)
        {
            GroupUser user = await _context.GroupUsers.FindAsync(id, userId);

            if (user.Role == Role.owner)
            {
                IQueryable <Group> userGroups = UserGroups(userId);
                var @group = userGroups.FirstOrDefault(g => g.GroupId == id);

                if (@group == null)
                {
                    return("null");
                }
                _context.Entry(@group).State = EntityState.Deleted;

                await _context.SaveChangesAsync();

                return("true");
            }
            else
            {
                return("false");
            }
        }
Exemplo n.º 3
0
        public async Task <bool> UpdateByIdAsync(Event @event)
        {
            _context.Entry(@event).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }

            catch (DbUpdateConcurrencyException)
            {
                if (!await EventExists(@event.EventId))
                {
                    return(false);
                }
                else
                {
                    throw;
                }
            }

            return(true);
        }