public string AddUrl(Uri uri) { var existingResult = _context.ShortUrls.FirstOrDefault(x => x.Url == uri.ToString()); if (existingResult != null) return existingResult.Id; var newUrl = new ShortUrl() { Added = DateTime.Now, Id = getUniqueHash(), Url = uri.ToString() }; _context.ShortUrls.InsertOnSubmit(newUrl); _context.SubmitChanges(); return newUrl.Id; }
partial void DeleteShortUrl(ShortUrl instance);
partial void UpdateShortUrl(ShortUrl instance);
partial void InsertShortUrl(ShortUrl instance);