Пример #1
0
        public ActionResult SinglePhoto(string photoId)
        {
            if (Session["login"] == null)
            {
                return(RedirectToAction("Login", "Auth"));
            }

            DBManager  dbm = new DBManager();
            PhotoShare p   = new PhotoShare();

            p.PhotoToShare = dbm.PhotoManager.GetPhotoForDetails((string)Session["user_id"], photoId);

            ConnectionBS cbs = new ConnectionBS((string)Session["user_id"]);

            p.PhotoToShare.PhotoPhatWhitSasKey = p.PhotoToShare.PhotoPhatOriginalSize + cbs.UserBSManager.GetContainerSasUri();

            return(View(p));
        }
Пример #2
0
        public ActionResult SharePhoto(string photoPath, PhotoShare photoShare)
        {
            DateTime finalDate = new DateTime(
                photoShare.DateOfExpire.Year,
                photoShare.DateOfExpire.Month,
                photoShare.DateOfExpire.Day,
                photoShare.TimeOfExpire.Hours,
                photoShare.TimeOfExpire.Minutes,
                photoShare.TimeOfExpire.Seconds);

            int totalMinutes = (int)finalDate.Subtract(DateTime.Now).TotalMinutes;

            totalMinutes = totalMinutes <= 0 ? 0 : totalMinutes;

            ConnectionBS cbs    = new ConnectionBS((string)Session["user_id"]);
            string       sasKey = cbs.UserBSManager.GetContainerSasUri(totalMinutes);

            // Log
            string[] urlParts = photoPath.Split('/');
            LogMaster.WriteOnLog("user " + (string)Session["user_id"] + " has share an image named " + urlParts.Last() + " for " + totalMinutes + " minutes ");

            return(Content(photoPath + sasKey));
        }
Пример #3
0
 //是否已分享
 public bool isShare(PhotoShare ps)
 {
     return(true);
 }
Пример #4
0
 //删除分享
 public bool deleteShare(PhotoShare ps)
 {
     return(true);
 }