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 }); }
public DeleteOutput <long> Delete(DeleteInput <long> input) { throw new NotSupportedException("This method is implemented but it is not safely to use it."); Tip tipEntityForDelete = TipRepository.Get(input.EntityId); if (tipEntityForDelete == null) { throw new CityQuestItemNotFoundException(CityQuestConsts.CityQuestItemNotFoundExceptionMessageBody, "\"Tip\""); } if (!TipPolicy.CanDeleteEntity(tipEntityForDelete)) { throw new CityQuestPolicyException(CityQuestConsts.CQPolicyExceptionDeleteDenied, "\"Tip\""); } TipRepository.Delete(tipEntityForDelete); return(new DeleteOutput <long>() { DeletedEntityId = input.EntityId }); }