示例#1
0
 public async Task <ArtifactModel> UpdateArtifact(UpdateArtifactModel updateArtifactModel)
 {
     if (updateArtifactModel != null)
     {
         return(await _artifactRepo.UpdateArtifact(updateArtifactModel).ConfigureAwait(false));
     }
     return(null);
 }
示例#2
0
        public async Task <IActionResult> UpdateArtifact(int id, [FromBody] UpdateArtifactModel updateArtifactModel)
        {
            if (ModelState.IsValid)
            {
                updateArtifactModel.Id = id;
                var artifact = await _artifactService.UpdateArtifact(updateArtifactModel).ConfigureAwait(false);

                if (artifact != null)
                {
                    return(Ok(artifact));
                }
                return(BadRequest("Something went wrong !"));
            }
            return(BadRequest("Something went wrong !"));
        }
示例#3
0
        public Artifact CreateArtifact(UpdateArtifactModel updateArtifactModel, Artifact oldArtifact)
        {
            var newArtifact = new Artifact
            {
                Id          = updateArtifactModel.Id,
                Title       = updateArtifactModel.Title,
                Bonus       = updateArtifactModel.Bonus,
                Reward      = updateArtifactModel.Reward,
                Status      = updateArtifactModel.Status,
                Type        = updateArtifactModel.Type,
                MemberId    = updateArtifactModel.MemberId,
                CommunityId = updateArtifactModel.CommunityId
            };

            return(_objDiffManager.UpdateObject(oldArtifact, newArtifact));
        }
示例#4
0
        public async Task <ArtifactModel> UpdateArtifact(UpdateArtifactModel artifactUpdates)
        {
            var oldArtifact = await _artifactDao.GetArtifact(artifactUpdates.Id).ConfigureAwait(false);

            if (oldArtifact != null)
            {
                var newArtifact = _modelFactory.CreateArtifact(artifactUpdates, oldArtifact);
                if (newArtifact != null)
                {
                    await _artifactDao.UpdateArtifact(newArtifact).ConfigureAwait(false);

                    return(_modelFactory.CreateArtifactModel(newArtifact));
                }
            }
            return(null);
        }