コード例 #1
0
        //
        // GET: /Manage/YogaArticle/Details/5

        public ActionResult Details(int id)
        {
            ViewYogaArticle  model  = client.GetById(id);
            ViewYogaArtClass entity = clientClass.GetById(model.ClassID);

            if (entity != null)
            {
                if (entity.ParentID != 0)
                {
                    ViewYogaArtClass entity2 = clientClass.GetById(entity.ParentID.Value);
                    if (entity2.ParentID != 0)
                    {
                        ViewYogaArtClass entity3 = clientClass.GetById(entity2.ParentID.Value);

                        ViewBag.ClassName = entity3.ClassName;
                    }
                    else
                    {
                        ViewBag.ClassName = entity2.ClassName;
                    }
                }
                else
                {
                    ViewBag.ClassName = entity.ClassName;
                }
            }
            return(View(model));
        }
コード例 #2
0
 public ActionResult Create(ViewYogaArticle model)
 {
     try
     {
         // TODO: Add insert logic here
         if (!string.IsNullOrEmpty(Request.Form["TwoParentID"]))
         {
             model.ClassID = Convert.ToInt32(Request.Form["TwoParentID"]);
         }
         else
         {
             if (!string.IsNullOrEmpty(Request.Form["ClassID"]))
             {
                 model.ClassID = Convert.ToInt32(Request.Form["ClassID"]);
             }
         }
         model.CreateTime = DateTime.Now;
         model.Creator    = "admin";
         model.IsDelete   = 0;
         model.IsPicture  = 0;
         model.IsCheck    = 0;
         model.Uid        = 0;
         model.CheckID    = 0;
         client.Add(model);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
コード例 #3
0
        //
        // GET: /Manage/YogaArticle/Edit/5

        public ActionResult Edit(int id)
        {
            ViewYogaArticle model = client.GetById(id);

            ViewBag.ClassName = clientClass.GetById(model.ClassID).ClassName;

            return(View(model));
        }
コード例 #4
0
 public int Update(ViewYogaArticle model)
 {
     try
     {
         return(YogaArticleServiceImpl.Update(model));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #5
0
        public List <ViewYogaArticle> GetYogaArticlePageList(string strWhere, DateTime?date, int page, int pagesize, out int count)
        {
            List <YogaArticle> list = Repository.GetYogaArticlePageList(strWhere, date, page, pagesize, out count);

            List <ViewYogaArticle> model = new List <ViewYogaArticle>();

            foreach (var item in list)
            {
                model.Add(ViewYogaArticle.ToViewModel(item));
            }
            return(model);
        }
コード例 #6
0
        public List <ViewYogaArticle> GetYogaArticleClassID(int id)
        {
            List <YogaArticle> list = Repository.GetYogaArticleClassID(id);

            List <ViewYogaArticle> model = new List <ViewYogaArticle>();

            foreach (var item in list)
            {
                model.Add(ViewYogaArticle.ToViewModel(item));
            }
            return(model);
        }
コード例 #7
0
        public ActionResult Delete(int id)
        {
            try
            {
                // TODO: Add update logic here
                ViewYogaArticle model = client.GetById(id);

                model.IsDelete = 1;
                client.Update(model);

                return(Json(new { code = 0 }));
            }
            catch
            {
                return(Json(new { code = 1 }));
            }
        }
コード例 #8
0
        public ActionResult Edit(ViewYogaArticle model)
        {
            try
            {
                // TODO: Add update logic here
                ViewYogaArticle entity = client.GetById(model.ID);

                entity.ArticleCon   = model.ArticleCon;
                entity.ArticleTitle = model.ArticleTitle;
                entity.Author       = model.Author;
                entity.PicPath      = model.PicPath;

                client.Update(entity);
                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
コード例 #9
0
 public ViewYogaArticle GetYogaArticleById(int id)
 {
     return(ViewYogaArticle.ToViewModel(Repository.GetYogaArticleById(id)));
 }
コード例 #10
0
 public int Update(ViewYogaArticle model)
 {
     Repository.updateEntity(ViewYogaArticle.ToEntity(model));
     return(Repository.Save());
 }
コード例 #11
0
 public int Add(ViewYogaArticle model)
 {
     Repository.Add(ViewYogaArticle.ToEntity(model));
     return(Repository.Save());
 }