public void Create(ElectricGuitarModel item)
        {
            var existingVendor = _context.Vendors.SingleOrDefault(v => v.Id == item.Vendor.Id);

            if (existingVendor == null)
            {
                _context.Vendors.Add(item.Vendor);
            }

            _context.ElectricGuitars.Add(item);
            _context.SaveChanges();
        }
Example #2
0
 public void AddToken(string token, string issuedTo, int expireMinutes)
 {
     ChangeUserAuthStatus(issuedTo, true);
     _context.TokenStorage.Add(new TokenModel {
         Token = token, IssuedTo = issuedTo, Expiry = Constants.Constants.Now().AddMinutes(expireMinutes)
     });
     _context.SaveChanges();
 }