Exemplo n.º 1
0
        public static bl_ActivityList_Result Edit(bl_ActivityList info)
        {
            using (var metadata = DataAccess.getDesktopMetadata())
            {
                //Get original guest record
                var qActCat = (from row in metadata.db_ActivityCategory
                               where row.activityCategoryID == info.activityCategoryID
                               select row).FirstOrDefault();

                var item = qActCat;
                if (item == null)
                {
                    throw new NullReferenceException("No Activity Category found. Refresh Page");
                }

                //item.Name = info.Name;
                //item.Price = info.Price;


                metadata.SaveChanges();

                var result = new bl_ActivityList_Result
                {
                    hasError = false
                };
                return(result);
            }
        }
Exemplo n.º 2
0
        public static bl_ActivityList_Result AddActivity(bl_ActivityList info)
        {
            using (var metadata = DataAccess.getDesktopMetadata())
            {
                var newActivity = new db_Activity
                {
                    activityCategoryID = info.activityCategoryID,
                    userID             = info.userID
                };

                metadata.db_Activity.Add(newActivity);
                metadata.SaveChanges();

                var result = new bl_ActivityList_Result
                {
                    hasError = false,
                };
                return(result);
            }
        }