public void Insert(INosSession nosSession) { using (var session = _nHibernateSessionProvider.GetSession()) { session.Save(nosSession); session.Flush(); } }
public void Update(INosSession nosSession) { using (var session = _nHibernateSessionProvider.GetSession()) { session.Update(nosSession); session.Flush(); } }
public Session(INosSession session) { Id = session.Id; Title = session.Title; Description = session.Description; Owner = session.Owner; timeSlot = session.Room; Tag = session.Tag; Start = session.Start; End = session.End; OwnerTag = session.OwnerTag; CreatedOn = session.CreatedOn; }
public INosSession UpdateSession(INosSession nosSession) { using(HttpClient httpClient = new HttpClient(_baseAddress)) { httpClient.DefaultRequestHeaders.Accept.Add(_json); string sessionUri = "session"; JavaScriptSerializer jsonSerializer = new JavaScriptSerializer(); byte[] customerBytes = Encoding.UTF8.GetBytes(jsonSerializer.Serialize(nosSession)); using (MemoryStream stream = new MemoryStream(customerBytes)) { StreamContent sessionContent = new StreamContent(stream); sessionContent.Headers.ContentType = _json; using (HttpResponseMessage response = httpClient.Put(sessionUri, sessionContent)) { nosSession = jsonSerializer.Deserialize<NosSession>(response.Content.ReadAsString()); } } return nosSession; } }