public override void OnActionExecuting(ActionExecutingContext filterContext) { var db = new Form115Entities(); var ap = filterContext.ActionParameters.First(); var ht = new HotelTracking { DateHT = DateTime.Now, IdHotel = (int)ap.Value }; db.HotelTracking.Add(ht); db.SaveChanges(); }
public override void OnActionExecuting(ActionExecutingContext filterContext) { var db = new Form115Entities(); // Accès au paramètre : id vaut IdHotel var ap = filterContext.ActionParameters.First(); // var parmName = ap.Key // normalement id // var paramValue = (int)ap.Value; var ht = new HotelTracking { DateHT = DateTime.Now, IdHotel = (int)ap.Value }; db.HotelTracking.Add(ht); db.SaveChanges(); }