Beispiel #1
0
        public ResponseModel <IEnumerable <ClientsModel> > Get(int idGroup)
        {
            var resp = new ResponseModel <IEnumerable <ClientsModel> >();

            try
            {
                IClientsRepository appRepo = new ClientsRepository(new DataBaseContext());
                var appList = appRepo.GetClientsModel(idGroup);

                if (appList != null && appList.Any())
                {
                    resp.Data        = appList;
                    resp.Status      = 200;
                    resp.Description = "OK";
                }
                else
                {
                    resp.Status      = 200;
                    resp.Description = "No clients";
                    resp.Data        = null;
                }
            }
            catch (Exception ex)
            {
                resp.Status      = 500;
                resp.Description = $"Error: {ex.Message}";
                resp.Data        = null;
            }

            return(resp);
        }