public async Task <ActionResult> UploadFile2()
        {
            string galleryID = Request.Form.GetValues("galleryID")[0];

            string galleryName         = MyString.DeleteSpecChars(DAL.uof.GalleryRepository.GetByID(new Guid(galleryID)).Title);
            int    ordMax              = 0;
            IEnumerable <Picture> pics = (IEnumerable <Picture>)(await DAL.uof.PictureRepository.GetAsync(filter: f => f.GalleryID == new Guid(galleryID), orderBy: q => q.OrderBy(d => d.Ord)));

            if (pics != null)
            {
                try
                {
                    ordMax = (int)pics.Max(p => p.Ord);
                }
                catch (Exception)
                {
                    ordMax = 0;
                }
            }

            try
            {
                foreach (string file in Request.Files)
                {
                    ordMax++;
                    var fileContent = Request.Files[file];
                    if (fileContent != null && fileContent.ContentLength > 0)
                    {
                        var stream = fileContent.InputStream;

                        string fType = Path.GetFileName(file);

                        fType = fType.Substring(fType.LastIndexOf("."));
                        string fileName = MyString.Translit(MyString.HyphenTrim(galleryName)) + "-" + ordMax.ToString() + fType;
                        string path     = Path.Combine(Server.MapPath("~/img/temp/"), fileName);
                        using (FileStream fs = new FileInfo(path).Create())
                        {
                            stream.CopyTo(fs);
                        }

                        string backFile  = Path.Combine(Server.MapPath("~/img/temp"), "template-big2.jpg");
                        string frontFile = Path.Combine(Server.MapPath("~/img/temp"), "template-front2.png");

                        ImageHelpers.ConvertFile2(path, backFile, frontFile, Server.MapPath("~/img/catalog/product-gallery"), fileName);

                        Picture picture = new Picture {
                            GalleryID = new Guid(galleryID), PicUrl = "/img/catalog/product-gallery/" + fileName, PictureID = Guid.NewGuid(), Ord = ordMax, Title = fileName
                        };
                        DAL.uof.PictureRepository.Insert(picture);
                        await DAL.uof.SaveAsync();
                    }
                }
            }
            catch (Exception e)
            {
                Response.StatusCode = (int)HttpStatusCode.BadRequest;
                return(Content("Сбой загрузки: " + e.Message));
            }
            if (Request.IsAjaxRequest())
            {
                return(PartialView("_Index", await DAL.uof.PictureRepository.GetAsync(filter: f => f.GalleryID == new Guid(galleryID), orderBy: q => q.OrderBy(d => d.PicUrl))));
            }

            return(Json("Файл успешно загружен."));
        }