Blog.Logic.Core.CommunityLogic.Add C# (CSharp) Метод

Add() публичный Метод

public Add ( Community community ) : Community
community Blog.Common.Contracts.Community
Результат Blog.Common.Contracts.Community
        public Community Add(Community community)
        {
            try
            {
                var checkCommunity = IsCommunityNameInUse(community.Name);
                if (checkCommunity)
                {
                    return new Community().GenerateError<Community>((int)Constants.Error.ValidationError,
                        string.Format("Community name {0} is already in use.", community.Name));
                }

                community.Members = new List<User>();
                community.Members.Add(community.Leader);

                return CommunityMapper.ToDto(_communityRepository.Add(CommunityMapper.ToEntity(community)));
            }
            catch (Exception ex)
            {
                throw new BlogException(ex.Message, ex.InnerException);
            }
        }