public void WebSrv_NI_NetworkIncident_Get1_Test() { long _id = 1; NetworkIncidentAccess _sut = new NetworkIncidentAccess(_niEntities); NetworkIncidentData _data = _sut.GetByPrimaryKey(_id, 1); Assert.IsNotNull(_data); Assert.AreEqual(_data.incident.IncidentId, _id); System.Diagnostics.Debug.WriteLine(_data.incident.ToString()); foreach (IncidentNoteData _note in _data.incidentNotes) { System.Diagnostics.Debug.WriteLine(_note.ToString()); } foreach (NetworkLogData _log in _data.networkLogs) { System.Diagnostics.Debug.WriteLine(_log.ToString()); } foreach (NetworkLogData _ilog in _data.deletedLogs) { System.Diagnostics.Debug.WriteLine(_ilog.ToString()); } foreach (SelectItem _nic in _data.NICs) { System.Diagnostics.Debug.WriteLine(_nic.ToString()); } foreach (SelectItem _it in _data.incidentTypes) { System.Diagnostics.Debug.WriteLine(_it.ToString()); } foreach (SelectItem _nt in _data.noteTypes) { System.Diagnostics.Debug.WriteLine(_nt.ToString()); } }
// // GET api/<controller>/5&serverId=1 public NetworkIncidentData Get(long id, [FromUri] int serverId) { NetworkIncidentAccess _access = new NetworkIncidentAccess(_incidentEntities); NetworkIncidentData _incidents = null; _incidents = _access.GetByPrimaryKey(id, serverId); return(_incidents); }
// // POST api/ProdCategory create // PUT api/ProdCategory/<key> update // DELETE api/ProdCategory/<key> delete // #region "restful updates" // /// <summary> /// POST api/<controller> /// NetworkIncidentData Insert(NetworkIncidentSave data) /// </summary> /// <param name="value"></param> /// <returns></returns> public NetworkIncidentData Post([FromBody] NetworkIncidentSave data) { // try { NetworkIncidentAccess _access = new NetworkIncidentAccess(_incidentEntities); return(_access.Insert(data)); } catch (Exception _ex) { Log.Logger.Log(LoggingLevel.Error, data.user.UserName, MethodBase.GetCurrentMethod(), data.incident.ToString() + _ex.Message, _ex); System.Diagnostics.Debug.WriteLine(_ex.ToString()); } return(new NetworkIncidentData()); }
public void IncidentTestInitialize() { // _niEntities = WebSrv_Tests.Effort_Helper.GetEffortEntity(_entityConnStr, _fullPath); _sut = new NetworkIncidentAccess(_niEntities); // server information _server = new ServerData() { ServerId = 1, CompanyId = 1, CompanyName = "Northern Software Group", ServerShortName = "nsg memb", ServerDescription = "public members site", ServerName = "Members services web-site", ServerLocation = "We are in Michigan, USA.", WebSite = "Web-site address: https://members.nsg.com", FromName = "Phil Huhn", FromNicName = "", FromEmailAddress = "*****@*****.**", TimeZone = "EST (UTC-5)", DST = true, TimeZone_DST = "EDT (UTC-4)", DST_Start = DateTime.Parse("2018-03-11T02:00:00"), DST_End = DateTime.Parse("2018-11-05T02:00:00") }; _user = new UserServerData() { // user Id = "422207c6-9210-4f39-ae20-f908ba6f3fcf", CompanyId = 1, UserName = "******", Email = "*****@*****.**", FirstName = "Phil", LastName = "Huhn", FullName = "Phil Huhn", UserNicName = "Phil", PhoneNumber = "", // server ServerShortNames = new SelectItem[] { new SelectItem("nsg memb", "NSG members site") }, ServerShortName = "nsg memb", // }; }
public void WebSrv_NI_NetworkIncident_Get0_Test() { long _id = 0; NetworkIncidentAccess _sut = new NetworkIncidentAccess(_niEntities); NetworkIncidentData _data = _sut.GetByPrimaryKey(_id, 1); Assert.IsNotNull(_data); Assert.AreEqual(_data.incident.IncidentId, _id); System.Diagnostics.Debug.WriteLine(_data.incident.ToString()); System.Diagnostics.Debug.WriteLine("Notes"); foreach (IncidentNoteData _note in _data.incidentNotes) { System.Diagnostics.Debug.WriteLine(_note.ToString()); } System.Diagnostics.Debug.WriteLine("Logs"); foreach (NetworkLogData _log in _data.networkLogs) { System.Diagnostics.Debug.WriteLine(_log.ToString()); } Assert.IsTrue(_data.networkLogs.Count > 0); }
// /// <summary> /// PUT api/<controller>/5 /// NetworkIncidentData Update(NetworkIncidentSave data) /// </summary> /// <param name="id"></param> /// <param name="value"></param> /// <returns></returns> public NetworkIncidentData Put(int id, [FromBody] NetworkIncidentSave value) { NetworkIncidentAccess _access = new NetworkIncidentAccess(_incidentEntities); return(_access.Update(value)); }