示例#1
0
        // GET: Activite/Details/5
        public ActionResult Details(int id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Activite A;

            A = activiteService.GetById((int)id);
            if (A == null)
            {
                return(HttpNotFound());
            }
            ActiviteVM pvm = new ActiviteVM()
            {
                ActiviteID  = A.ActiviteID,
                Title       = A.Title,
                Description = A.Description,
                Affiche     = A.Affiche,
                Document    = A.Document,
                Theme       = A.Theme,
                Outils      = A.Outils,
                AgeMin      = A.AgeMin,
                AgeMax      = A.AgeMax,
                ClassSize   = A.ClassSize,
                Duration    = A.Duration,
                Professor   = A.Professor,
                Start       = A.Start,
                Location    = A.Location,
                //    nomuser = User.Identity.GetUserName(),
                UserId = "f43c21cf-f35a-4897-a9e3-343c00afe7b3"
            };
            var t = activiteService.GetMany();

            foreach (Activite Act in t)
            {
                var         path1 = Path.Combine(Server.MapPath("~/Content/Uploads"), Act.Affiche);
                KalikoImage image = new KalikoImage(path1);
                KalikoImage thumb = image.Scale(new CropScaling(90, 80));
                var         path2 = Path.Combine(Server.MapPath("~/Content/Uploads"), Act.Title + "latest.jpg");
                thumb.SaveJpg(path2, 99);
            }
            List <Activite> Courses = t.ToList();

            ViewData["Courses"] = Courses;
            return(View(pvm));
        }
 //  GET api/<controller>/5
 public Activite Get(int id)
 {
     return(activiteService.GetById(id));
 }