public void UpdateMalfunctionSession() { try { IMalfunctionSession malfunctionSession = new MalfunctionSession() { MalfunctionId = Guid.Parse("7E900088-B42A-4708-A6C5-AE46C048E775"), LeakDetailsId = Guid.Parse("C124835B-4B82-4CAB-A173-44601AC73012"), MalfunctionComments = "malfunction updated", IsLokRingJobRequired = "y", IsBreakIn = "y", IsTurnAroudItem = "y", IsDownTimeRequired = "y", IsManLiftRequired = "y", IsFirstTimePump = "y", IsInstallClampRequired = "y", IsRePump = "y", IsWirewrapRequired = "y", OnHold = "y", }; ltr.Update((MalfunctionSession)malfunctionSession); } catch (Exception ex) { throw ex; } }
public void AddMalfunctionSession() { try { IMalfunctionSession malfunctionSession = new MalfunctionSession() { MalfunctionId = Guid.NewGuid(), LeakDetailsId = Guid.Parse("C124835B-4B82-4CAB-A173-44601AC73012"), MalfunctionComments = "malfunction 2", IsLokRingJobRequired = "y", IsBreakIn = "n", IsTurnAroudItem = "n", IsDownTimeRequired = "n", IsManLiftRequired = "y", IsFirstTimePump = "y", IsInstallClampRequired = "y", IsRePump = "y", IsWirewrapRequired = "y", OnHold = "y", }; ltr.Create((MalfunctionSession)malfunctionSession); } catch (Exception ex) { throw ex; } }
// PUT: api/MalfunctionSession/5 public HttpResponseMessage Put(MalfunctionSession malfunctionSession) { try { response.StatusCode = HttpStatusCode.Created; response.Content = new StringContent(malfunctionSessionFactory.Update(malfunctionSession).ToString()); response.Headers.CacheControl = new CacheControlHeaderValue() { MaxAge = TimeSpan.FromMinutes(20) }; } catch (Exception ex) { response.StatusCode = HttpStatusCode.BadRequest; response.Content = new StringContent(ex.Message); response.Headers.CacheControl = new CacheControlHeaderValue() { MaxAge = TimeSpan.FromMinutes(20) }; } return(response); }