Example #1
0
 public ActionResult Editor(Int32 mid, ContentProviderType cpt, Int32 flag, Int32 id = 0) {
     PageViewModel model = null;
     model = id > 0 ? _pageService.GetModel(m => m.Id == id) : _pageService.GetModel(m => m.BelongTo == mid && m.BelongType == flag);
     ViewBag.Route = _contentRouteProvider.Get(flag);
     ViewBag.Cpt = cpt;
     ViewBag.Mid = mid;
     ViewBag.Flag = flag;
     return View(model);
 }
Example #2
0
        public ActionResult EditorPost(PageViewModel model, ContentProviderType cpt, Int32 mid, Int32 flag) {
            var user = _authenticationService.GetAuthenticatedUser();

            Page page = null;
            if (model.Id > 0) {
                page = _pageService.Get(model.Id);
                BuildPage(model, user, page, mid, flag);
                page.UpdateAt = DateTime.UtcNow;
            } else {
                if (cpt == ContentProviderType.Content)
                    page = _pageService.Get(m => m.BelongTo == mid && m.BelongType == flag);

                if (page != null) {
                    BuildPage(model, user, page, mid, flag);
                    page.UpdateAt = DateTime.UtcNow;
                } else {
                    page = Mapper.Map<PageViewModel, Page>(model);
                    var content = Mapper.Map<PageViewModel, EntityContent>(model);
                    page.Content = content;
                    BuildPage(model, user, page, mid, flag);
                    _pageService.Add(page);
                }
            }
            if (cpt == ContentProviderType.Content)
                return RedirectToAction("Editor", new {
                    mid,
                    flag,
                    cpt,
                    page.Id
                });

            return RedirectToAction("Index", new {
                mid,
                flag
            });
        }
Example #3
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="type">
 /// Provider of the media file.
 /// / line: LINE.The binary media data can be retrieved from the content endpoint.
 /// / external: Provider other than LINE
 /// </param>
 /// <param name="originalContentUrl">
 /// URL of the media file. Only included when contentProvider.type is external.
 /// </param>
 /// <param name="previewImageUrl">
 /// URL of the preview image. Only included when contentProvider.type is external.
 /// </param>
 public ContentProvider(ContentProviderType type, string originalContentUrl = null, string previewImageUrl = null)
 {
     Type = type;
     OriginalContentUrl = originalContentUrl;
     PreviewImageUrl    = previewImageUrl;
 }