Exemplo n.º 1
0
 public async Task <CommunityModel> UpdateCommunity(UpdateCommunityModel updateCommunityModel)
 {
     if (updateCommunityModel != null)
     {
         await _communityRepo.UpdateCommunity(updateCommunityModel).ConfigureAwait(false);
     }
     return(null);
 }
Exemplo n.º 2
0
        public Community CreateCommunity(UpdateCommunityModel updateCommunityModel, Community originalCommunity)
        {
            var newCommunity = new Community
            {
                Id    = updateCommunityModel.Id,
                Name  = updateCommunityModel.Name,
                Email = updateCommunityModel.Email
            };

            return(_objDiffManager.UpdateObject(originalCommunity, newCommunity));
        }
Exemplo n.º 3
0
        public async Task <IHttpActionResult> UpdateCommunity(int id, [FromBody] UpdateCommunityModel updateCommunityModel)
        {
            if (ModelState.IsValid)
            {
                updateCommunityModel.Id = id;
                var community = await _communityService.UpdateCommunity(updateCommunityModel).ConfigureAwait(false);

                if (community != null)
                {
                    return(Ok(community));
                }
                return(BadRequest("Something went wrong !"));
            }
            return(BadRequest("Something went wrong !"));
        }
Exemplo n.º 4
0
        public async Task <CommunityModel> UpdateCommunity(UpdateCommunityModel communityUpdates)
        {
            var oldCommunity = await _communityDao.GetCommunity(communityUpdates.Id).ConfigureAwait(false);

            if (oldCommunity != null)
            {
                var newCommunity = _modelFactory.CreateCommunity(communityUpdates, oldCommunity);
                if (newCommunity != null)
                {
                    await _communityDao.UpdateCommunity(newCommunity).ConfigureAwait(false);

                    return(_modelFactory.CreateCommunityModel(newCommunity));
                }
            }
            return(null);
        }