1: using Ia.Ngn.Cl.Model;
2: using System;
3: using System.Collections.Generic;
4: using System.Linq;
5: using System.Runtime.Serialization;
6: using System.Web.Http;
7:
8: namespace Ia.Ngn.Ofn.Wa.Api.Model.Controller
9: {
10: ////////////////////////////////////////////////////////////////////////////
11:
12: /// <summary publish="true">
13: /// Access API Controller class of Optical Fiber Network (OFN) model.
14: /// </summary>
15: ///
16: /// <remarks>
17: /// Copyright © 2006-2022 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
18: ///
19: /// This library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
20: /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
21: ///
22: /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
23: /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
24: ///
25: /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
26: ///
27: /// Copyright notice: This notice may not be removed or altered from any source distribution.
28: /// </remarks>
29: [Authorize]
30: public class AccessController : ApiController
31: {
32: private static readonly object objectLock = new object();
33:
34: ////////////////////////////////////////////////////////////////////////////
35:
36: /// <summary>
37: /// AccessResponse
38: /// </summary>
39: [DataContract(IsReference = true, Namespace = "kw.com.ia.ofn.api.access", Name = "AccessResponse")]
40: public class AccessResponse
41: {
42: /// <summary/>
43: [DataMember]
44: public string Id { get; set; }
45:
46: /// <summary/>
47: [DataMember]
48: public int Olt { get; set; }
49:
50: /// <summary/>
51: [DataMember]
52: public int Pon { get; set; }
53:
54: /// <summary/>
55: [DataMember]
56: public int Ont { get; set; }
57:
58: /// <summary/>
59: [DataMember]
60: public string Odf { get; set; }
61:
62: /// <summary/>
63: [DataMember]
64: public int AreaId { get; set; }
65:
66: /// <summary/>
67: [DataMember]
68: public string Block { get; set; }
69:
70: /// <summary/>
71: [DataMember]
72: public string Street { get; set; }
73:
74: /// <summary/>
75: [DataMember]
76: public string PremisesOld { get; set; }
77:
78: /// <summary/>
79: [DataMember]
80: public string PremisesNew { get; set; }
81:
82: /// <summary/>
83: [DataMember]
84: public string Paci { get; set; }
85:
86: /// <summary/>
87: [DataMember]
88: public string Note { get; set; }
89:
90: /// <summary/>
91: [DataMember]
92: public DateTime Created { get; set; }
93:
94: /// <summary/>
95: [DataMember]
96: public DateTime Updated { get; set; }
97:
98: /// <summary/>
99: [DataMember]
100: public System.Guid UserId { get; set; }
101: }
102:
103: ////////////////////////////////////////////////////////////////////////////
104:
105: /// <summary>
106: /// List of Accesses
107: /// </summary>
108: [HttpGet]
109: [Route("api/v1/accesses")]
110: public List<AccessResponse> List()
111: {
112: var list0 = Ia.Ngn.Cl.Model.Data.Access.List();
113:
114: var list = new List<AccessResponse>();
115:
116: foreach (var l in list0)
117: {
118: list.Add(new AccessResponse
119: {
120: Id = l.Id,
121: Olt = l.Olt,
122: Pon = l.Pon,
123: Ont = l.Ont,
124: Odf = l.Odf,
125: AreaId = l.AreaId,
126: Block = l.Block,
127: Street = l.Street,
128: PremisesOld = l.PremisesOld,
129: PremisesNew = l.PremisesNew,
130: Paci = l.Paci,
131: Note = l.Note,
132: Created = l.Created,
133: Updated = l.Updated,
134: UserId = l.UserId
135: });
136: }
137:
138: return list;
139: }
140:
141: ////////////////////////////////////////////////////////////////////////////
142: ////////////////////////////////////////////////////////////////////////////
143: }
144: }