public void UpdateOrderInDB([FromBody] User value, string key) { var db = new UserModelDataContext(); int keyValueAsInt = Int32.Parse(key); var query = from User in db.Users where User.Id == keyValueAsInt select User; var userInDB = query.First(); #region changeDb if (userInDB.username != value.username) { userInDB.username = value.username; } if (userInDB.password != value.password) { userInDB.password = value.password; } if (userInDB.email != value.email) { userInDB.email = value.email; } if (userInDB.phone_number != value.phone_number) { userInDB.phone_number = value.phone_number; } #endregion db.SubmitChanges(); }
public void WriteOrderToDB([FromBody] User value) { var db = new UserModelDataContext(); db.Users.InsertOnSubmit(value); db.SubmitChanges(); }