Exemplo n.º 1
0
        public ActionResult Index(string name, int chunk, int chunks, HttpPostedFileBase data)
        {
            var result = new AjaxResult();
            var path = Server.MapPath("~/temp/");
            using (var fs = System.IO.File.Create(path + name + "_" + chunk))
            {
                fs.Write(data.InputStream);
            }

            if (chunk == chunks - 1)
            {
                var mergePath = path + name;
                using (var fs = System.IO.File.Create(mergePath))
                {
                    for (int i = 0; i < chunks; i++)
                    {
                        var chunkPath = path + name + "_" + i;
                        using (var cf = System.IO.File.OpenRead(chunkPath))
                        {
                            fs.Write(cf);
                        }
                        System.IO.File.Delete(chunkPath);
                    }

                    var file = Manager.Files.Add(fs);
                    result.Data = new { id = file.ID };
                }

                System.IO.File.Delete(mergePath);
            }

            return Json(result);
        }
Exemplo n.º 2
0
        public ActionResult Edit(int id,string mtext)
        {
            var result = new AjaxResult();
            var tag = Manager.AdminPixivTags.Find(id);
            tag.MText = mtext;
            try
            {
                Manager.AdminPixivTags.Update(tag);
            }
            catch (Exception e)
            {
                result.Success = false;
                result.Message = e.Message;
                throw;
            }

            return Content(Newtonsoft.Json.JsonConvert.SerializeObject(result),"application/json");
        }