Ejemplo n.º 1
0
 public async Task <int> CreateCommunity(CreateCommunityModel createCommunityModel)
 {
     if (createCommunityModel != null && !IsEmailUsed(createCommunityModel.Email))
     {
         return(await _communityRepo.SaveCommunity(createCommunityModel).ConfigureAwait(false));
     }
     return(-1);
 }
Ejemplo n.º 2
0
 public Community CreateCommunity(CreateCommunityModel createCommunityModel)
 {
     return(new Community
     {
         Name = createCommunityModel.Name,
         Email = createCommunityModel.Email,
     });
 }
Ejemplo n.º 3
0
 private CommunityModel GetCommunity(CreateCommunityModel createCommunityModel)
 {
     return(new CommunityModel
     {
         Email = createCommunityModel.Email,
         Name = createCommunityModel.Name
     });
 }
Ejemplo n.º 4
0
        public async Task <IHttpActionResult> CreateCommunity([FromBody] CreateCommunityModel createCommunityModel)
        {
            if (ModelState.IsValid)
            {
                var communityId = await _communityService.CreateCommunity(createCommunityModel).ConfigureAwait(false);

                if (communityId != -1)
                {
                    return(Created("", $"{Request.RequestUri.AbsoluteUri}/{communityId}"));
                }
                return(BadRequest("Something went wrong !"));
            }
            return(BadRequest("Something went wrong !"));
        }
Ejemplo n.º 5
0
        public async Task <int> SaveCommunity(CreateCommunityModel createCommunityModel)
        {
            var community = _modelFactory.CreateCommunity(createCommunityModel);

            return(await _communityDao.SaveCommunity(community).ConfigureAwait(false));
        }