public async Task <DietResponse> Create(CreateDietRequest request) { DietEntity _CreatedEntity = await __DietRepository.CreateAsync(request.ToEntity()); return(_CreatedEntity.ToResponse() ?? new DietResponse { Success = false, ErrorMessage = $"{GlobalConstants.ERROR_ACTION_PREFIX} create {ENTITY_NAME}." }); }
public async Task <DietResponse> Get(UIDRequest request) { DietResponse _Response = new DietResponse(); if (request.UID == Guid.Empty) { _Response.Success = false; _Response.ErrorMessage = $"{GlobalConstants.ERROR_ACTION_PREFIX} retrieve {ENTITY_NAME}."; } DietEntity _DietEntity = await __DietRepository.GetAsync(request.UID); if (_DietEntity == null) { _Response.Success = false; _Response.ErrorMessage = $"{GlobalConstants.ERROR_ACTION_PREFIX} retrieve {ENTITY_NAME}."; } return(_DietEntity.ToResponse() ?? _Response); }