public async Task <CommunityModel> UpdateCommunity(UpdateCommunityModel updateCommunityModel) { if (updateCommunityModel != null) { await _communityRepo.UpdateCommunity(updateCommunityModel).ConfigureAwait(false); } return(null); }
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)); }
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 !")); }
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); }