public async Task <BaseResponse <Disease> > Handle(CreateDiseaseCommand request, CancellationToken cancellationToken) { var response = new BaseResponse <Disease> { ReponseName = nameof(CreateDiseaseCommand), Content = new List <Disease> () { } }; var entity = _mapper.Map <Disease> (request); var newentity = await _diseaseRepository.AddAsync(entity); if (newentity == null) { response.Status = ResponseType.Error; response.Message = $"{nameof(Disease)} could not be created."; response.Content = null; } else { response.Status = ResponseType.Success; response.Message = $"{nameof(Disease)} created successfully."; response.Content.Add(newentity); } return(response); }
public async Task <int> Add(Disease disease) { return(await _diseaseRepository.AddAsync(disease)); }