public IHttpActionResult Post(MyParkCreate myPark) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var service = CreateMyParkService(); if (!service.CreateMyPark(myPark)) { return(InternalServerError()); } return(Ok()); }
public bool CreateMyPark(MyParkCreate model) { var entity = new MyPark() { OwnerID = _userID, ParkID = model.ParkID, TrailID = model.TrailID, MyTrailStatus = model.MyTrailStatus, TrailComment = model.TrailComment }; using (var ctx = new ApplicationDbContext()) { ctx.MyParks.Add(entity); return(ctx.SaveChanges() == 1); } }
public bool CreateMyPark(MyParkCreate model) { throw new NotImplementedException(); }