Exemple #1
0
        public ResultEntity <GroupAdministratorEntity> Update(GroupAdministratorEntity groupadministratorEntity)
        {
            var validationResult = new ResultEntity <GroupAdministratorEntity>();

            using (var groupadministratorDA = new GroupAdministratorDA())
            {
                var groupList = groupadministratorDA.GetByGroupName(groupadministratorEntity.GroupName);

                var linq = (from x in groupList
                            where x.ID != groupadministratorEntity.ID
                            select x).ToList <GroupAdministratorEntity>();

                if (linq.Count() > 0)
                {
                    validationResult.Warning.Add("Groupname " + groupadministratorEntity.GroupName + " already exist");
                    return(validationResult);
                }

                groupadministratorEntity.ModifiedDate = DateTime.Now;
                var resultUpdate = groupadministratorDA.Update(groupadministratorEntity);

                if (resultUpdate <= 0)
                {
                    validationResult.Warning.Add("Failed Updating GroupAdministrator!");
                    return(validationResult);
                }

                validationResult.Value = groupadministratorEntity;
            }

            return(validationResult);
        }
Exemple #2
0
        public ResultEntity <GroupAdministratorEntity> Create(GroupAdministratorEntity groupadministratorEntity)
        {
            var validationResult = new ResultEntity <GroupAdministratorEntity>();

            using (var groupadministratorDA = new GroupAdministratorDA())
            {
                var groupList = groupadministratorDA.GetByGroupName(groupadministratorEntity.GroupName);

                if (groupList.Count() > 0)
                {
                    validationResult.Warning.Add("Groupname " + groupadministratorEntity.GroupName + " already exist");
                    return(validationResult);
                }

                groupadministratorEntity.CreatedDate = DateTime.Now;
                validationResult.Value = groupadministratorDA.Create(groupadministratorEntity);
            }

            return(validationResult);
        }