Beispiel #1
0
        public ActionResult WallpaperList()
        {
            RewardsDTO wdto = new RewardsDTO();

            wdto = _ipres.GetWallPaperList();
            return(View(wdto));
        }
Beispiel #2
0
        public override RewardsDTO Edit_Wall(int id)
        {
            using (var context = new PHCEntities())
            {
                try
                {
                    RewardsDTO dto = new RewardsDTO();

                    Wallpaper wall = new Wallpaper();
                    wall = context.Wallpapers.Where(p => p.WID == id).SingleOrDefault();
                    if (wall != null)
                    {
                        dto.WID       = wall.WID;
                        dto.Title     = wall.Title;
                        dto.WallImage = wall.WallImage;
                    }

                    return(dto);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
Beispiel #3
0
        public override string Update_Wall(RewardsDTO dto)
        {
            string msg = "";

            using (var context = new PHCEntities())
            {
                try
                {
                    Wallpaper wall = new Wallpaper();
                    wall = context.Wallpapers.Where(p => p.WID == dto.WID).SingleOrDefault();
                    if (wall != null)
                    {
                        wall.Title     = dto.Title;
                        wall.WallImage = dto.WallImage;
                        context.SaveChanges();
                        msg = "success";
                    }
                }
                catch (Exception ex)
                {
                    msg = ex.Message;
                }
            }
            return(msg);
        }
Beispiel #4
0
        public ActionResult EditWall(int id)
        {
            RewardsDTO dto = new RewardsDTO();

            dto = _ichp.Edit_Wall(id);
            return(View(dto));
        }
Beispiel #5
0
 public override List <RewardsDTO> GetWall_list()
 {
     using (var context = new PHCEntities())
     {
         List <RewardsDTO> ldto = new List <RewardsDTO>();
         RewardsDTO        dto  = null;
         try
         {
             List <Wallpaper> bdg = new List <Wallpaper>();
             bdg = context.Wallpapers.ToList();
             if (bdg != null)
             {
                 foreach (Wallpaper b in bdg)
                 {
                     dto           = new RewardsDTO();
                     dto.WID       = b.WID;
                     dto.Title     = b.Title;
                     dto.WallImage = "~/Content/Uploads/Challenges/" + b.WallImage;
                     ldto.Add(dto);
                 }
             }
         }
         catch (Exception)
         {
             throw;
         }
         return(ldto);
     }
 }
Beispiel #6
0
 public ActionResult Wallpaper(RewardsDTO dto, FormCollection frm)
 {
     if (ModelState.IsValid)
     {
         HttpPostedFileBase badgfile       = Request.Files["upbadge"];
         string             WallpaperImage = UploadImg(badgfile);
         if (!string.IsNullOrEmpty(WallpaperImage))
         {
             RewardsDTO adto = new RewardsDTO();
             adto.Title     = dto.Title;
             adto.WallImage = WallpaperImage;
             string msg = _ichp.Save_Wallpaper(adto);
             if (msg == "success")
             {
                 TempData["Success"] = "Saved Successfully";
                 return(RedirectToAction("WallList"));
             }
         }
     }
     return(View());
 }
Beispiel #7
0
        public override string Save_Wallpaper(RewardsDTO adto)
        {
            string msg = "";

            using (var context = new PHCEntities())
            {
                try
                {
                    Wallpaper bg = new Wallpaper();
                    bg.Title     = adto.Title;
                    bg.WallImage = adto.WallImage;

                    context.AddToWallpapers(bg);
                    context.SaveChanges();
                    msg = "success";
                }
                catch (Exception ex)
                {
                    msg = ex.Message;
                }
                return(msg);
            }
        }
Beispiel #8
0
        public ActionResult EditWall(int id, RewardsDTO dto)
        {
            if (dto != null)
            {
                HttpPostedFileBase file     = Request.Files["upbadge"];
                string             wall_img = dto.WallImage;

                if (Request.Files["upbadge"] != null && file.FileName != "")
                {
                    wall_img      = UploadImg(file);
                    dto.WallImage = wall_img;
                }


                string msg = _ichp.Update_Wall(dto);
                if (msg == "success")
                {
                    TempData["Success"] = "Updated Successfully";
                    return(RedirectToAction("WallList"));
                }
            }
            return(View(dto));
        }
Beispiel #9
0
 public string Update_Wall(RewardsDTO dto)
 {
     return(_ipres.Update_Wall(dto));
 }
Beispiel #10
0
 public string Save_Wallpaper(RewardsDTO adto)
 {
     return(_ipres.Save_Wallpaper(adto));
 }
Beispiel #11
0
 public abstract string Update_Wall(RewardsDTO dto);
Beispiel #12
0
 public abstract string Save_Wallpaper(RewardsDTO adto);