コード例 #1
0
        // GET: Home
        public ActionResult AddUrl(string URL)
        {
            var shortURL = Helper.RandomString(5); //Generate random 5 char string

            //add properties to database.
            db.Urls.Add(new Url {
                ShortURL = shortURL,
                LongURL  = URL,
                Created  = DateTime.Now,
            });

            db.SaveChanges();

            return(View("Index"));
        }
コード例 #2
0
 public void Save()
 {
     _db.SaveChanges();
 }