Esempio n. 1
0
        //Get all basic tables
        // DEFAULT CRUD
        public IEnumerable <SupplyRequestMapper> GetSupplyRequests()
        {
            var content = db.SupplyRequests.ToList();

            if (content.Count() == 0)
            {
                return(null);
            }
            else
            {
                List <SupplyRequestMapper> requests = new List <SupplyRequestMapper>();

                foreach (var item in content)
                {
                    SupplyRequestMapper request = new SupplyRequestMapper
                    {
                        SupplyRequestId = item.supplyRequestId,
                        TenantId        = item.tenantId ?? default(int),
                        Active          = item.active ?? default(bool)
                    };
                    requests.Add(request);
                }
                return(requests);
            }
        }
Esempio n. 2
0
        //Get one basic table
        // DEFAULT CRUD
        public SupplyRequestMapper GetSupplyRequest(int supplyRequestId)
        {
            SupplyRequest content = db.SupplyRequests.FirstOrDefault(i => i.supplyRequestId == supplyRequestId);

            if (content == null)
            {
                return(null);
            }
            else
            {
                SupplyRequestMapper request = new SupplyRequestMapper
                {
                    SupplyRequestId = content.supplyRequestId,
                    TenantId        = content.tenantId ?? default(int),
                    Active          = content.active ?? default(bool)
                };
                return(request);
            }
        }