Пример #1
0
        public ActionResult Create(NewModel model)
        {
            if (model.File != null && model.File.ContentLength > 0)
            {
                var fileName = Path.GetFileName(model.File.FileName);
                var path     = Path.Combine(Server.MapPath("~/Upload/News/"), fileName);
                model.File.SaveAs(path);
                model.IMGPATH = fileName;
            }
            model.CONTENT = HttpUtility.HtmlDecode(model.CONTENT);
            var check = _newStoreService.CreateNew(model);
            var msg   = check
                ? "Add new New Successfully"
                : string.Format("The New ID {0} is exited.", model.ID);

            return(Json(msg));
        }