예제 #1
0
        public void getByKeys_returns_int()
        {
            // ARrange
            // Act
            var result = _serv.getByKeys(LCategory.memberstatus, LMemberStatus.Active);

            // Assert
            Assert.IsInstanceOfType(result, typeof(int));
        }
예제 #2
0
        public JsonResult Create(Domain.Activity activ, string userName)
        {
            UpdateModel(activ);
            activ.firstID = activ.ID;

            if (activ.nameID == 0)
            {
                if (activ.typeID == lcache.getByKeys(LCategory.activityType, LActType.Assembly))
                {
                    activ.nameID = lcache.getByKeys(LCategory.activityName, LActName.Assembly);
                }
                else if (activ.typeID == lcache.getByKeys(LCategory.activityType, LActType.OrgMtg))
                {
                    activ.nameID = lcache.getByKeys(LCategory.activityName, LActName.OrgMtg);
                }
                else
                {
                    throw new MacheteIntegrityException("Something went wrong with Activity Types.");
                }
            }

            if (activ.dateEnd < activ.dateStart)
            {
                return(Json(new { jobSuccess = false, rtnMessage = "End date must be greater than start date." }));
            }

            Domain.Activity firstAct = serv.Create(activ, userName);
            var             result   = map.Map <Domain.Activity, ViewModel.Activity>(firstAct);

            if (activ.recurring == true)
            {
                result.tablabel = "Recurring event with " + firstAct.teacher;
                result.tabref   = "/Activity/CreateMany/" + Convert.ToString(firstAct.ID);
            }


            return(Json(new
            {
                sNewRef = result.tabref,
                sNewLabel = result.tablabel,
                iNewID = result.ID,
                jobSuccess = true
            }));
        }