Beispiel #1
0
        public JsonResult DeleteMemories(int id)
        {
            var Memories = MermoriesServices.GetSinglememorys(id);
            var Data     = MermoriesServices.Delete(id);

            return(Json(Memories, JsonRequestBehavior.AllowGet));
        }
Beispiel #2
0
 public ActionResult DisplayImages(int?id)
 {
     if (Session["UserId"] != null)
     {
         if (id == 1)
         {
             MemoriesModel model = new MemoriesModel()
             {
                 Memories = MermoriesServices.GetMemories(Convert.ToInt32(Session["UserId"]))
             };
             return(View(model));
         }
         else if (id == 2)
         {
             MemoriesModel model = new MemoriesModel()
             {
                 Memories = MermoriesServices.GetAllMemories(Convert.ToInt32(Session["UserId"]))
             };
             return(View(model));
         }
         else
         {
         }
     }
     return(RedirectToAction(LoginPages.Login, LoginPages.Account, new { area = "" }));
 }
Beispiel #3
0
 public ActionResult DisplayImages(int?id)
 {
     if (Session["UserId"] != null)
     {
         MemoriesModel model = new MemoriesModel()
         {
             Memories = MermoriesServices.GetAllMemoriesforfaculty()
         };
         return(View(model));
     }
     return(RedirectToAction(LoginPages.Login, LoginPages.Account, new { area = "" }));
 }
Beispiel #4
0
        public ActionResult memories(MemoriesModel Model, IEnumerable <HttpPostedFileBase> Image)
        {
            if (Session["UserId"] != null)
            {
                List <Visible> visibleto = new List <Visible>();
                visibleto.Add(new Visible {
                    visibleTo = "To My Batch Mates"
                });
                visibleto.Add(new Visible {
                    visibleTo = "To All"
                });
                MemoriesModel model = new MemoriesModel()
                {
                    Visibleto = visibleto
                };

                if (Model.memoriesId != 0)
                {
                    View_UserDetails Userdetails = UserDetailsViewService.GetUserByUserId(Convert.ToInt32(Session["UserId"]));

                    int?VisibleTo = 0;
                    if (Model.visible == "To My Batch Mates")
                    {
                        VisibleTo = Convert.ToInt32(Convert.ToInt32(Userdetails.Batch) - Convert.ToInt32(Userdetails.Years));
                    }
                    db_Memories_Info Mories = new db_Memories_Info()
                    {
                        Heading          = Model.Heading,
                        CreatedOn        = DateTime.Now,
                        Description      = Model.Description,
                        MemoryDate       = Model.date,
                        Userid           = Convert.ToInt64(Session["UserId"].ToString()),
                        Status           = true,
                        VisibleTo        = Model.visible,
                        VisibleBatchfrom = VisibleTo,
                        VisibleBatchTo   = Userdetails.Batch,
                        MemoriesId       = Model.memoriesId
                    };
                    db_Memories_Info InsertMemories = MermoriesServices.UpdateMemories(Mories);

                    if (Image != null)
                    {
                        foreach (var Images in Image)
                        {
                            if (Images != null)
                            {
                                var fileName = Path.GetFileName(Images.FileName);
                                var path     = Path.Combine(Server.MapPath("~/UserPostingImages/" + fileName));
                                Images.SaveAs(path);
                                var FilePath = "/UserPostingImages/" + fileName;
                                db_Memories_images images = new db_Memories_images()
                                {
                                    Image      = FilePath,
                                    CreatedOn  = DateTime.Now,
                                    MemoriesId = InsertMemories.MemoriesId,
                                    Status     = true,
                                };
                                MermoriesServices.InsertImages(images);
                            }
                        }
                    }
                    TempData["Message"] = "Memories Updated successfully...";
                    return(RedirectToAction("DisplayImages", "Memories", new { area = "Alumini", id = 1 }));
                }

                else
                {
                    if (ModelState.IsValid)
                    {
                        View_UserDetails Userdetails = UserDetailsViewService.GetUserByUserId(Convert.ToInt32(Session["UserId"]));

                        int?VisibleTo = 0;
                        if (Model.visible == "To My Batch Mates")
                        {
                            VisibleTo = Convert.ToInt32(Convert.ToInt32(Userdetails.Batch) - Convert.ToInt32(Userdetails.Years));
                        }
                        db_Memories_Info Mories = new db_Memories_Info()
                        {
                            Heading          = Model.Heading,
                            CreatedOn        = DateTime.Now,
                            Description      = Model.Description,
                            MemoryDate       = Model.date,
                            Userid           = Convert.ToInt64(Session["UserId"].ToString()),
                            Status           = true,
                            VisibleTo        = Model.visible,
                            VisibleBatchfrom = VisibleTo,
                            VisibleBatchTo   = Userdetails.Batch
                        };
                        db_Memories_Info InsertMemories = MermoriesServices.Create(Mories);

                        if (Image != null)
                        {
                            foreach (var Images in Image)
                            {
                                var fileName = Path.GetFileName(Images.FileName);
                                var path     = Path.Combine(Server.MapPath("~/UserPostingImages/" + fileName));
                                Images.SaveAs(path);
                                var FilePath = "/UserPostingImages/" + fileName;
                                db_Memories_images images = new db_Memories_images()
                                {
                                    Image      = FilePath,
                                    CreatedOn  = DateTime.Now,
                                    MemoriesId = InsertMemories.MemoriesId,
                                    Status     = true,
                                };
                                MermoriesServices.InsertImages(images);
                            }
                        }
                        TempData["Message"] = "Your memories added successfully...";
                        return(RedirectToAction("DisplayImages", "Memories", new { area = "Alumini", id = 1 }));
                    }
                }
                return(View(model));
            }

            return(RedirectToAction(LoginPages.Login, LoginPages.Account, new { area = "" }));
        }
Beispiel #5
0
        public JsonResult DeleteImagesforMemories(int Memoriesid, int Imageid)
        {
            var Data = MermoriesServices.DeleteMeoryimage(Imageid, Memoriesid);

            return(Json(Data, JsonRequestBehavior.AllowGet));
        }
Beispiel #6
0
        public JsonResult GetMemoriesforEdit(int Memoriesid)
        {
            var Data = MermoriesServices.GetSinglememorys(Memoriesid);

            return(Json(Data, JsonRequestBehavior.AllowGet));
        }