Exemplo n.º 1
0
        public string GetResourceName(int resourceTypeId)
        {
            var tr = TicketResources.FirstOrDefault(x => x.ResourceTypeId == resourceTypeId);

            if (tr != null)
            {
                return(tr.ResourceName);
            }
            return("");
        }
Exemplo n.º 2
0
        public void UpdateResource(int resourceTypeId, int resourceId, string resourceName, int accountId, string resourceCustomData)
        {
            var r = TicketResources.SingleOrDefault(x => x.ResourceTypeId == resourceTypeId);

            if (r == null && resourceId > 0)
            {
                TicketResources.Add(new TicketResource {
                    ResourceId = resourceId, ResourceName = resourceName, ResourceTypeId = resourceTypeId, AccountId = accountId, ResourceCustomData = resourceCustomData
                });
            }
            else if (r != null && resourceId > 0)
            {
                r.AccountId      = accountId;
                r.ResourceId     = resourceId;
                r.ResourceName   = resourceName;
                r.ResourceTypeId = resourceTypeId;
            }
            else if (r != null && resourceId == 0)
            {
                TicketResources.Remove(r);
            }
        }