public ActionResult RefuseEvent(int id) { List <EventPicture> pics = sep.GetMany(x => x.eventid == id).ToList(); foreach (var item in pics) { // if (System.IO.File.Exists(Request.MapPath(@"../Content/eventpics/" + item.picName))) // { System.IO.File.Delete(Request.MapPath(@"/Content/eventpics/" + item.picName)); //} sep.Delete(item); sep.Commit(); } IServiceMS spsms = new ServiceMS(); IServiceUserEvent spue = new serviceUserEvent(); string mails = spue.GetMany(x => x.participation == true).SelectMany(x => x.User.mail.Split(',')).ToString(); if (mails != null) { spsms.sendMail(mails, "l'évenement " + spe.GetById(id).EventTitle + "a été supprimer", "l'annonce de cet evenement a été suprrimer verifier avec les organizateurs de cet evenement"); } spe.refuseEvent(id); return(RedirectToAction("EventNotApproved")); }
public JsonResult Like(int ide) { IServiceUserEvent spue = new serviceUserEvent(); int? uid1 = spu.Get(x => x.username == User.Identity.Name).id; UserEvent uev = new UserEvent(); if (uid1 != null) { int uid = uid1.GetValueOrDefault(); uev = spue.Get(x => x.userid == uid && x.eventid == ide); if (uev == null) { // if the user didn't like the event before spue.like(uid, ide); return(Json(new { IsOk = true, Eventid = ide, Action = "liked" })); } else { if (uev.like == false) { uev.like = true; spue.Update(uev); spue.Commit(); return(Json(new { IsOk = true, Eventid = ide, Action = "liked" })); } else { uev.like = false; spue.Update(uev); spue.Commit(); return(Json(new { IsOk = true, Eventid = ide, Action = "unlike" })); } } } else { return(Json(new { IsOk = true, Eventid = ide, Action = "false" })); } }
public ActionResult AcceptAnnonce(int id) { Admin _admin = spa.Get(x => x.mailAdmin == User.Identity.Name); spe.acceptEvent(id, _admin.idAdmin); Logs log = new Logs(); log.adminid = _admin.idAdmin; log.eventid = id; log.date = DateTime.Now; spl.Add(log); spl.Commit(); IServiceMS spsms = new ServiceMS(); IServiceUserEvent spue = new serviceUserEvent(); string mails = spue.GetMany(x => x.participation == true).SelectMany(x => x.User.mail.Split(',')).ToString(); if (mails != null) { spsms.sendMail(mails, "l'évenement " + spe.GetById(id).EventTitle + "a été modifier consulter le lien ci dessous pour voir les changements", "localhost:8080/Event/Details/" + id); } return(RedirectToAction("EventNotApproved")); }
// GET: Event/Details/5 public ActionResult Details(int id) { IServiceUserEvent spue = new serviceUserEvent(); Event _event = spe.GetById(id); List <EventPicture> pic = sep.GetMany(x => x.eventid == id).ToList(); ViewBag.participate = false; if (User.Identity.IsAuthenticated && spa.Get(x => x.mailAdmin == User.Identity.Name) == null) { int uid = spu.Get(x => x.username == User.Identity.Name).id; if (spue.Get(x => x.eventid == id && x.userid == uid) != null) { ViewBag.participate = spue.Get(x => x.eventid == id && x.userid == uid).participation; } } ViewBag.like = false; if (User.Identity.IsAuthenticated && spa.Get(x => x.mailAdmin == User.Identity.Name) == null) { int uid = spu.Get(x => x.username == User.Identity.Name).id; if (spue.Get(x => x.eventid == id && x.userid == uid) != null) { ViewBag.like = spue.Get(x => x.eventid == id && x.userid == uid).like; } } if (_event.hostedby == null) { ViewBag.hostedby = spo.GetById((long)_event.hostedbyid).orgname; } ViewData.Model = _event; ViewBag.pic = pic; return(View()); }