Esempio n. 1
0
        public void UpdateCoursePicture(string tempPictureName, int companyID, int courseID)
        {
            string tempPath    = GetTempPicturePath(tempPictureName);
            Stream tempPicture = GetPictureFromTemp(tempPath);

            if (tempPicture == null)
            {
                throw new FileNotFoundException();
            }

            var model = new CoursePictureModel
            {
                CompanyID = companyID,
                CourseID  = courseID,
                Picture   = tempPicture
            };

            imageStorage.UpdateCoursePicture(model);

            object locker = GetOrAddConcurrentKey(companyID, courseID);

            lock (locker)
            {
                SavePictureToCache(model);
            }

            DeletePictureFromTemp(tempPath);
        }