public object PostBisSets(BisSetPayload bisSetPayload) { try { BisSet bisSet = _context.BisSets.FirstOrDefault(_bisSet => _bisSet.Sets == bisSetPayload.payload); if (bisSet != null) { return(bisSet.Identifier); } string id = string.Empty; do { id = Guid.NewGuid().ToString().Replace("-", string.Empty); bisSet = _context.BisSets.FirstOrDefault(_bisSet => _bisSet.Identifier == id); }while (bisSet != null); bisSet = new BisSet { Identifier = id, Sets = bisSetPayload.payload }; _context.BisSets.Add(bisSet); _context.SaveChanges(true); return(id); } catch { return(""); } }
public object GetBisSets([FromQuery(Name = "id")] string id) { try { BisSet bisSet = _context.BisSets.FirstOrDefault(_bisSet => _bisSet.Identifier == id); if (bisSet == null) { return("[]"); } else { return(bisSet.Sets); } } catch { return("[]"); } }