public int JobComplete(int jobID) { using (var db = new CoordinationDbContext()) { Model.Job job = db.Jobs.FirstOrDefault(jb => jb.ID == jobID); if (job != null) { job.Completed = true; db.Entry(job).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(0); } return(1); } }
public int SendLastKnownLocation(String latitude, String longitude, String ID) { string latitude_ = latitude; string longitude_ = longitude; int ID_ = int.Parse(ID); using (var db = new CoordinationDbContext()) { Model.User user = db.Users.FirstOrDefault(usr => usr.ID == ID_); if (user == null) { return(-1); } user.Latitude = latitude_; user.Longitude = longitude_; db.Entry(user).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(0); } }