예제 #1
0
        public bool DeletePost(int id)
        {
            PostAdmission acustomer = _dbContext.PostAdmissions.FirstOrDefault((c => c.Id == id));

            _dbContext.PostAdmissions.Remove(acustomer);
            return(_dbContext.SaveChanges() > 0);
        }
        public ActionResult PostAdmission(PostViewModel postViewModel)
        {
            string message = "";

            if (ModelState.IsValid)
            {
                //string fileName = Path.GetFileNameWithoutExtension(postViewModel.ImageFile.FileName);
                string fileName = Path.GetFileNameWithoutExtension(postViewModel.Files.FileName);
                postViewModel.FilePath = fileName + System.IO.Path.GetExtension(postViewModel.Files.FileName);
                fileName = "~/Notice/" + fileName + System.IO.Path.GetExtension(postViewModel.Files.FileName);
                postViewModel.Files.SaveAs(Server.MapPath(fileName));

                PostAdmission post = Mapper.Map <PostAdmission>(postViewModel);

                if (_adminManager.PostAdmission(post))
                {
                    message = "Done Successfully  ";
                }
                else
                {
                    message = "The email or cell number is already Exist";
                }
            }
            else
            {
                message = "Successfully  Failed";
            }
            ViewBag.Message = message;
            //postViewModel.PostAdmissions = _adminManager.ViewPost();
            return(RedirectToAction("Index"));
        }
예제 #3
0
        public bool PostAdmission(PostAdmission postAdmission)
        {
            _dbContext.PostAdmissions.Add(postAdmission);


            return(_dbContext.SaveChanges() > 0);
        }
        public ActionResult UpdatePost(PostViewModel postViewModel)
        {
            string message = "";

            if (ModelState.IsValid)
            {
                PostAdmission post = Mapper.Map <PostAdmission>(postViewModel);

                if (_adminManager.UpdatePost(post))
                {
                    message = "Updated";
                }
                else
                {
                    message = "Not Updated";
                }
            }
            else
            {
                message = "Update Failed";
            }

            ViewBag.Message = message;
            postViewModel.PostAdmissions = _adminManager.GetAll();
            return(RedirectToAction("ViewAdmission"));
        }
        public FileResult DownloadFile(int id, PostAdmission obj)
        {
            obj = _dbContext.PostAdmissions.FirstOrDefault(c => c.Id == id);

            string filepath = Server.MapPath("~/Notice/" + obj.FilePath);

            return(File(filepath, "application/pdf", obj.FilePath + ".pdf"));
        }
예제 #6
0
        public bool UpdatePost(PostAdmission postAdmission)
        {
            PostAdmission post = _dbContext.PostAdmissions.FirstOrDefault(c => c.Id == postAdmission.Id);

            if (post != null)
            {
                post.PostType       = postAdmission.PostType;
                post.UniversityName = postAdmission.UniversityName;
                post.PostDate       = postAdmission.PostDate;
                post.StartTest      = postAdmission.StartTest;
                post.EndTest        = postAdmission.EndTest;
                post.TotalSeat      = postAdmission.TotalSeat;
                post.FilePath       = postAdmission.FilePath;
            }
            return(_dbContext.SaveChanges() > 0);
        }
 public ActionResult ViewAdmission(PostAdmission postAdmission)
 {
     ModelState.Clear();
     return(View(_adminManager.GetAll()));
 }
예제 #8
0
 public bool UpdatePost(PostAdmission postAdmission)
 {
     return(_admin.UpdatePost(postAdmission));
 }
예제 #9
0
 public bool PostAdmission(PostAdmission postAdmission)
 {
     return(_admin.PostAdmission(postAdmission));
 }