Exemplo n.º 1
0
        public List <BottomTypeModel> GetBottomTypes()
        {
            List <BottomTypeModel> bottomTypes = null;

            try
            {
                using (MyDiveEntities MyDiveDB = new MyDiveEntities())
                {
                    ObjectResult <stp_GetBottomType_Result> serverResult = MyDiveDB.stp_GetBottomType();
                    bottomTypes = new List <BottomTypeModel>();

                    foreach (stp_GetBottomType_Result res in serverResult)
                    {
                        bottomTypes.Add(new BottomTypeModel
                        {
                            BottomTypeID   = res.BottomTypeID,
                            BottomTypeName = res.BottomType
                        });
                    }
                }
            }
            catch (Exception ex)
            {
                bottomTypes = null;
            }

            return(bottomTypes.Count > 0 ? bottomTypes : null);
        }