public JObject Post(JObject o) { using (var db = DrivingScoolContextHelper.CreateDataContext2()) { Uzivatele newU; try { db.Uzivatele.InsertOnSubmit(newU = new Uzivatele() { //UzivatelID = o.Value<uint>("uzivatel_id"), UzivatelskeJmeno = o.Value<string>("uzivatelske_jmeno"), Heslo = o.Value<string>("heslo"), Role = o.Value<string>("role") }); db.SubmitChanges(); return JObject.FromObject(JArray.FromObject( from u in db.Uzivatele where (u.UzivatelID == newU.UzivatelID) select new { uzivatel_id = u.UzivatelID, uzivatelske_jmeno = u.UzivatelskeJmeno, heslo = u.Heslo, role = u.Role, })[0]); } catch (ArgumentOutOfRangeException) { return new JObject(); } catch (MySqlException) { throw new HttpResponseException(HttpStatusCode.InternalServerError); } } }
private void UziVatELE_Detach(Uzivatele entity) { entity.RoleRole = null; }
private void UziVatELE_Attach(Uzivatele entity) { entity.RoleRole = this; }