Exemple #1
0
        private string UploadSignal(string filePath, string destFilePathPrefix, MobileResolution resolution, bool isOrignal)
        {
            var destFile = string.Empty;

            if (!string.IsNullOrEmpty(filePath))
            {
                var width  = resolution.Value.GetResolutionWidth();
                var height = resolution.Value.GetResolutionHeight();

                var imagePixel = string.Format("{0}x{1}", width, height);
                if (!isOrignal)
                {
                    var thumbnailPixel = imagePixel.GetThumbnailPixelByOriginal();
                    width  = thumbnailPixel.GetResolutionWidth();
                    height = thumbnailPixel.GetResolutionHeight();

                    destFile = ImageHelper.Resized(filePath, destFilePathPrefix, width, height, imagePixel);
                }
                else
                {
                    destFile = ImageHelper.Resized(filePath, destFilePathPrefix, width, height, string.Empty);
                }
            }
            return(destFile);
        }
        public ActionResult ResolutionEdit(MobileResolution model)
        {
            var resolution = dbContextService.Single <MobileResolution>(model.Id);

            resolution.Name           = model.Name;
            resolution.Value          = resolution.Value;
            resolution.Status         = model.Status;
            resolution.Comment        = model.Comment;
            resolution.CreateDateTime = DateTime.Now;

            dbContextService.Update <MobileResolution>(resolution);
            return(RedirectToAction("ResolutionList"));
        }
        public ActionResult ResolutionAdd(MobileResolution model)
        {
            var exist = dbContextService.Exists <MobileResolution>(x => x.Value == model.Value);

            if (exist)
            {
                TempData["errorMsg"] = "该分辨率已经存在!";
                return(View());
            }
            var ret = dbContextService.Add <MobileResolution>(model);

            return(RedirectToAction("ResolutionList"));
        }