예제 #1
0
        /// <summary>
        /// Get shortlink for only the first reference to the requested short/pretty name.
        /// We want to prevent more than one existing on add.
        /// </summary>
        /// <param name="context">Database context</param>
        /// <param name="prettyname">The short name or pretty name used for the shortlink.</param>
        /// <returns>Returns null if no results or too many results found.</returns>
        public static Shortlink GetShortlinkFromDb(AkaContext context, string prettyname)
        {
            Shortlink         result;
            DbSet <Shortlink> links = context.Shortlinks;

            foreach (Shortlink sl in links)
            {
                if (prettyname.Equals(sl.PrettyName))
                {
                    return(sl);
                }
            }

            return(null);
        }
예제 #2
0
 public static Shortlink GetShortlinkFromDb(AkaContext _context, int id)
 {
     return(_context.Shortlinks.Find(id));
 }
예제 #3
0
 public static int GetNextAvailableIDFrom(AkaContext context)
 {
     return(1);
 }
예제 #4
0
 public AkaController(ILogger <AkaController> logger, AkaContext context)
 {
     _logger  = logger;
     _context = context;
 }