public async Task <bool> SaveStatus(EventInvite invite) { _context.Entry(invite).State = EntityState.Modified; await _context.SaveChangesAsync(); return(true); }
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"); } }
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); }