public ActionResult Create(ActionModel actionModel, HttpPostedFileBase fa) { actionModel.imageAction = fa.FileName; action action = new action(); mapaction mapaction = new mapaction(); action.titreAction = actionModel.titreAction; action.dateDebutAction = actionModel.dateDebutAction; action.dateFinAction = actionModel.dateFinAction; action.imageAction = actionModel.imageAction; action.discriptionAction = actionModel.discriptionAction; action.localisation = mapaction.idMap; mapaction.altitude = actionModel.lat; mapaction.longitude = actionModel.lag; uow.GetRepository <mapaction>().Add(mapaction); uow.GetRepository <action>().Add(action); uow.Commit(); //Sauvgarde de l'image var path = Path.Combine(Server.MapPath("~/Content/Upload/"), fa.FileName); fa.SaveAs(path); return(RedirectToAction("Index")); }
public mapaction DisplayMap(int id) { MapModel mapModel = new MapModel(); mapaction article1 = new mapaction(); article1 = mapService.GetById(id); mapModel.Lag = (float)article1.longitude; mapModel.Lat = (float)article1.altitude; return(article1); }