Пример #1
0
        // public List<DAL.ClientModel.Activity> getActivities()
        //{

        public ActivityCollectionResponseMessage getActivities(ActivityManagerRequestMessage reqMsgs)
        {
            if (!Licensed.isValid(reqMsgs))
            {
                ActivityFaultContract AFC = new ActivityFaultContract()
                {
                    RequestTime = DateTime.Now, Method = "getActivities", ErrorMessage = "Wrong License Key"
                };

                //throw new FaultException<ActivityFaultContract>(AFC, "NO LICENSES");
            }
            List <DAL.ClientModel.Activity> la = null;
            List <DAL.Activity>             ld = null;

            using (ActivityDbEntities Db = new ActivityDbEntities())
            {
                ld = Db.Activity.ToList();
            }
            if (ld.Count < 1)
            {
                ActivityFaultContract AFC = new ActivityFaultContract()
                {
                    RequestTime = DateTime.Now, Method = "getActivities", ErrorMessage = "No Activity available"
                };

                throw new FaultException <ActivityFaultContract>(AFC, "No Data");
            }
            else
            {
                la = ld.Select(l => AutoMapper <DAL.ClientModel.Activity, DAL.Activity> .Map(l)).ToList();
            }

            return(new ActivityCollectionResponseMessage()
            {
                datas = la
            });
        }
Пример #2
0
 public static bool isValid(ActivityManagerRequestMessage reqMsg)
 {
     return(reqMsg.LicenceKey == ValidLicenseKey);
 }