public async Task <ServiceResult> Add( [FromForm] string name, [FromForm] string imagePath, [FromForm] string secret) { await _primaryStorageDb.Guests.AddAsync(new PrimaryStorage.Entities.Guest { Name = name, Secret = secret, ImagePath = imagePath }); await _primaryStorageDb.SaveChangesAsync(); return(ServiceResult.Success); }
public async Task <ServiceResult> Add( [FromForm] string name, [FromForm] string ordered) { if (name == null || name.Length < 2 || ordered == null || ordered.Length < 2) { return(null); } await _primaryStorageDb.Songs.AddAsync(new PrimaryStorage.Entities.Song { Name = name, Ordered = ordered }); await _primaryStorageDb.SaveChangesAsync(); return(ServiceResult.Success); }
public async Task <ServiceResult> Accept(string secret, [FromForm] bool accept) { if (_primaryStorageDb.Guests.Where(g => g.Secret == secret).Count() > 0) { var guests = _primaryStorageDb.Guests.Where(g => g.Secret == secret); foreach (var guest in guests) { guest.Accepted = accept; } await _primaryStorageDb.SaveChangesAsync(); return(ServiceResult.Success); } return(null); }