Beispiel #1
0
 public ActionResult Edit(ViewtBanner model)
 {
     try
     {
         // TODO: Add update logic here
         int    iType  = model.iType.Value;
         string strPic = model.spic;
         string strUrl = model.sUrl;
         model = client.GettBannerById(model.ID);
         if (Directory.Exists(model.spic))
         {
             Directory.Delete(model.spic);//删除文件夹中图片
         }
         ViewtBanner entity = new ViewtBanner();
         entity.ID         = model.ID;
         entity.spic       = strPic;
         entity.sUrl       = strUrl;
         entity.iType      = iType;
         entity.CreateDate = DateTime.Now;
         client.Update(entity);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
 public int Add(ViewtBanner model)
 {
     try
     {
         return(tBannerServiceImpl.Add(model));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public List <ViewtBanner> GettBannerPageList(string where, int Gender, int YogisLevel, string YogaTypeid, int page, int pagesize, out int count)
        {
            List <tBanner> list = Repository.GettBannerPageList(where, Gender, YogisLevel, YogaTypeid, page, pagesize, out count);

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

            foreach (var item in list)
            {
                model.Add(ViewtBanner.ToViewModel(item));
            }
            return(model);
        }
        public List <ViewtBanner> GettBannerPageListUp(int page, int pagesize, out int count)
        {
            List <tBanner> list = Repository.GettBannerPageListUp(page, pagesize, out count);

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

            foreach (var item in list)
            {
                model.Add(ViewtBanner.ToViewModel(item));
            }
            return(model);
        }
        public List <ViewtBanner> GettBannerUid(int id)
        {
            List <tBanner> list = Repository.GettBannerUid(id);

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

            foreach (var item in list)
            {
                model.Add(ViewtBanner.ToViewModel(item));
            }
            return(model);
        }
Beispiel #6
0
        //
        // GET: /Manage/tBanner/Details/5

        public ActionResult Details(int id)
        {
            ViewtBanner model = client.GettBannerById(id);

            if (model != null)
            {
                return(View(model));
            }
            else
            {
                return(View());
            }
        }
Beispiel #7
0
        public ActionResult Create(ViewtBanner model)
        {
            try
            {
                // TODO: Add insert logic here

                model.CreateDate = DateTime.Now;
                client.Add(model);
                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Beispiel #8
0
        //
        // GET: /Manage/tBanner/Edit/5

        public ActionResult Edit(int id)
        {
            ViewtBanner model = client.GettBannerById(id);

            return(View(model));
        }
 public int Update(ViewtBanner model)
 {
     Repository.updateEntity(ViewtBanner.ToEntity(model));
     return(Repository.Save());
 }
 public ViewtBanner GetById(int id)
 {
     return(ViewtBanner.ToViewModel(Repository.Get(id)));
 }
 public int Add(ViewtBanner model)
 {
     Repository.Add(ViewtBanner.ToEntity(model));
     return(Repository.Save());
 }