public IHttpActionResult TrailPost(Trail trail) { var originalTrail = _db.Trails.Find(trail.Id); originalTrail.Trailnumber = trail.Trailnumber; originalTrail.Name = trail.Name; originalTrail.Status = trail.Status; originalTrail.Time = trail.Time; _db.SaveChanges(); return Ok(); }
public IHttpActionResult Post(TrailViewModel trail) { Trail dbtrail = new Trail() { Trailnumber = trail.Trailnumber, Name = trail.Name, Status = trail.Status, Time = trail.Time, UserId = User.Identity.GetUserId() }; _db.Trails.Add(dbtrail); _db.SaveChanges(); return Ok(trail); }