Exemple #1
0
        public UpdateOutput <TipDto, long> Update(UpdateInput <TipDto, long> input)
        {
            throw new NotSupportedException("This method is implemented but it is not safely to use it.");

            Tip newTipEntity = input.Entity.MapTo <Tip>();

            if (newTipEntity == null)
            {
                throw new CityQuestItemNotFoundException(CityQuestConsts.CityQuestItemNotFoundExceptionMessageBody, "\"Tip\"");
            }

            if (!TipPolicy.CanUpdateEntity(newTipEntity))
            {
                throw new CityQuestPolicyException(CityQuestConsts.CQPolicyExceptionUpdateDenied, "\"Tip\"");
            }

            TipRepository.Includes.Add(r => r.LastModifierUser);
            TipRepository.Includes.Add(r => r.CreatorUser);

            TipRepository.Update(newTipEntity);
            TipDto newTipDto = (TipRepository.Get(newTipEntity.Id)).MapTo <TipDto>();

            TipRepository.Includes.Clear();

            return(new UpdateOutput <TipDto, long>()
            {
                UpdatedEntity = newTipDto
            });
        }
Exemple #2
0
        private Tip UpdateTipEntity(Tip existTip, TipDto newTip)
        {
            existTip.TipText = newTip.TipText;
            existTip.Name    = newTip.Name;
            existTip.Order   = newTip.Order;

            return(TipRepository.Update(existTip));
        }