public async Task <ActionResult <ApiResponse> > GetEntityType(int id) { try { AppEntityType type = await _repo.GetEntityTypeByIdAsync(id); if (type == null) { return(NotFound(new ApiResponse(StatusCodes.Status404NotFound, "Erro. Tipo de entidade não encontrado."))); } AppEntityTypeModel typeModel = new AppEntityTypeModel() { Id = type.Id, Name = type.Name }; return(Ok(new ApiResponse <AppEntityTypeModel>(StatusCodes.Status200OK, "OK", typeModel))); } catch (Exception) { return(StatusCode(StatusCodes.Status500InternalServerError, new ApiResponse(StatusCodes.Status500InternalServerError, "Erro inesperado. Tente mais tarde."))); } }
public void RemoveEntityType(AppEntityType typeToRemove) { _db.AppEntityTypes.Remove(typeToRemove); }
public void AddEntityType(AppEntityType newType) { _db.AppEntityTypes.Add(newType); }