public async Task <IActionResult> UpdateCard(UpdateCardRequestDTO updateCardRequestDTO)
        {
            try
            {
                await _cardService.UpdateCard(updateCardRequestDTO);

                return(Ok());
            }
            catch (Exception ex)
            {
                return(BadRequest("An error has occurred on Saving Project " + ex));
            }
        }
        public async Task <UpdateCardRequestDTO> GetCardByCardData(UpdateCardRequestDTO updateCardRequestDTO)
        {
            var query = @$ "
            SELECT C.* 
            FROM Card C
            WHERE Title = @Title
            AND Description = @Description
            AND IsActive = @IsActive";

            DynamicParameters param = new DynamicParameters();

            param.Add("@Title", updateCardRequestDTO.Title);
            param.Add("@Description", updateCardRequestDTO.Description);
            param.Add("@IsActive", true);

            return(await _db.QuerySingleOrDefaultAsync <UpdateCardRequestDTO>(sql : query, param : param, commandType : CommandType.Text));
        }
コード例 #3
0
        public static Card ToEntity(this UpdateCardRequestDTO updateCardRequestDTO, Card card, int position)
        {
            switch (position)
            {
            case 0:
            {
                card.Status = "TO DO";
                break;
            }

            case 1:
            {
                card.Status = "IN PROGRESS";
                break;
            }

            case 2:
            {
                card.Status = "FOR TESTING";
                break;
            }

            case 3:
            {
                card.Status = "COMPLETED";
                break;
            }
            }

            card.CreatedDate  = DateTime.Now;
            card.ModifiedDate = DateTime.Now;
            card.IsActive     = true;
            card.Title        = updateCardRequestDTO.Title;
            card.Description  = updateCardRequestDTO.Description;
            card.Assignee     = updateCardRequestDTO.Assignee;
            card.Reporter     = updateCardRequestDTO.Reporter;
            card.Priority     = updateCardRequestDTO.Priority;
            card.Estimate     = updateCardRequestDTO.Estimate;
            card.ProjectId    = Convert.ToInt32(updateCardRequestDTO.ProjectId);
            card.Id           = updateCardRequestDTO.CardId;
            return(card);
        }
コード例 #4
0
        public async Task UpdateCard(UpdateCardRequestDTO updateCardRequestDTO)
        {
            Card card = new Card();

            try
            {
                if (updateCardRequestDTO != null)
                {
                    var retrieveCardData = await _unitOfWokDapper.CardQueries.GetCardByCardData(updateCardRequestDTO);

                    retrieveCardData.ToEntity(card, updateCardRequestDTO.Position);
                    await _unitOfWork.CardRepository.UpdateCardAsync(card);
                }
            }
            catch (Exception ex)
            {
                _logger.LogExceptionError(ex.ToString());
                throw ex;
            }
        }